Nth Phonetic Mnemonic

    zipbot

    0.2.5 • Public • Published

    Zipwhip Bot SDK

    This library automates the process of enabling and disabling webhooks upon bot installation. It gives users' a clean way to listen in on events triggering upon a Zipwhip account all while letting them focus on business logic.

    Chatbot Example

    const { Bot, Event } = require("../dist/index");
    const badWords = require('./badwords');
    
    const bot = new Bot(process.env.BOT_ID);
    
    let counter = 0;
    
    bot.on(Event.Receive, (ctx, msg) => {
      switch (msg.body) {
        case "count":
          counter++;
          ctx.reply(`The counter is at ${counter}`);
          break;
        case "reset"
          counter = 0;
          ctx.reply("I've reset the counter");
      }
    });
    
    bot.run();

    This library works hand in hand with the Zipwhip App Store, automatically listening for the activate/deactivate webhooks which initializes the webhooks and other resources required for the bots operation

    UI Components

    const { Bot, Event } = require("../dist/index");
    const badWords = require('./badwords');
    
    const bot = new Bot(process.env.BOT_ID);
    let counter = 0;
    
    bot.sidebar((ui, {convId, line}) => {
      ui.text("Conversation Id: " + convId);
      ui.text("Line: " + line);
    
      ui.text("Page has been hit " + counter + " times")
      ui.button("Reset Counter", () => counter = 0)
    
      ui.button("Hello World!", () => console.log("Hello, World!"))
      ui.button("Goodbye!", () => console.log("Goodbye!"))
    
      counter++;
    });
    
    bot.on(Event.Receive, (ctx, msg) => {
      switch (msg.body) {
        case "count":
          ctx.reply("I've seen ", counter, "visitors");
          break;
        case "reset":
          counter = 0;
          ctx.reply("I've reset the counter for you!");
          break;
      }
    });
    
    bot.run();

    This code will produce the following ui component:

    Sidebar Example

    Keywords

    none

    Install

    npm i zipbot

    DownloadsWeekly Downloads

    2

    Version

    0.2.5

    License

    ISC

    Unpacked Size

    47.9 kB

    Total Files

    32

    Last publish

    Collaborators

    • ajmwagar