Introducing: @zoomus/chatbot-cli

Zach Zheng
Zoom Developer Blog
3 min readMay 7, 2020

There are many things that a developer must learn in order to develop on a new platform such as Zoom Marketplace. These include reading the api docs, performing authentication, refreshing tokens, etc. These are all standard processes, yet every platform does these things slightly differently. On top of that, for those who have never built a chatbot before, they would also have to think about how to structure their code, how to parse and process user inputs, how to return output back to the user. This makes it difficult even for seasoned developers to get started.

At Zoom, we want to make developers’ lives a little bit easier by introducing tools that allow them to quickly get a chatbot up and running. We already had a library called @zoomus/chatbot that interfaces with Zoom API endpoints such as OAuth and send messages. However, we wanted to take it one step further and introduce a command line tool that sets up the entire chatbot project for the developer. This tool is similar to other command line tools that will set up a project (think express-generator or create-react-app), and allows developers to not worry about boilerplate code and instead focus all their attention to their core business logic.

This tool is called @zoomus/chatbot-cli. This new command line tool is built on top of @zoomus/chatbot, and can be used by developers to automatically generate chatbot project boilerplate code for you! This new developer tool will automatically generate a project with skeleton code that empowers you to:

  • Add bot commands
  • Define endpoints for bots to receive requests
  • Access all the powers of @zoomus/chatbot to interface with Zoom APIs.
  • Quickly see a demo bot and be able to play around with Zoom chatbot features

For new users, we recommend running the demo chatbot that comes with the tool, this will allow you to quickly see how it works and allows you to play around with its features. To run the demo chatbot, please see the “Included Demos” section of @zoomus/chatbot-cli.

Once you have the demo running, you can easily add new commands by simply adding them to a predefined file (botConfig.js) and then defining the callback function that is triggered when that command is issued by the user in Zoom Chat.

Example: botConfig.js file with line 49–54 defining that “testcommand” will trigger the function in “./src/testcommand.js”:

Here is an example “./src/testcommand.js”, which sends a reply back to the user who issued it. zoomApp, zoomError, zoomWebhook, and databaseModels are automatically exposed by our middleware:

The zoomApp object is automatically instantiated from @zoomus/chatbot using the credentials in your environment variables (please see “Setup & Features” section in @zoomus/chatbot-cli), and is then auto-injected into each of your callback functions. You can then use the zoomApp object to interface with Zoom’s APIs.

In closing, you, Zoom Developer, now have two choices to quickly build chatbots to engage customers using Zoom Chat:

  1. You can use @zoomus/chatbot library and incorporate it into your own code to interface with Zoom’s APIs.
  2. If you wish to quickly set up a chatbot skeleton project and/or see a demo chatbot, then @zoomus/chatbot-cli is for you.

P.S, this is an open source tool, so if you wish to make this (or any other of our open source tools) better, feel free to submit a pull request to our Github!

--

--