Tutorials>RingCentral Bot using IBM Watson and Botkit

Learn how to build a RingCentral Bot with IBM Watson and Botkit using node.js

Start Tutorial

Welcome to the Getting Started with RingCentral Bot Tutorials

RingCentral provides a single, unified team workspace that empowers you to work, communicate, and collaberate faster and more effectively.

In this tutorial, we will look at how to build bots to enhances the productivity even more than ever before usign IBM Watson.


  • Create Two free RingCentral developer account with Platform and API access (Don't have a RingCentral Account, no worries. Get your free RingCentral Developer Account Now)
    • Account #1 - for building a bot.
    • Account #2 - for testing the bot
  • Create an application defined in the RingCentral Developer Portal that has the following properties:

    • Platform Type: server-only
    • API Permissions: Team Messaging
  • An IBM Blumix account.

  • Credentials for IBM Watson personality Insight.

Clone Repo

  • As a first step, clone the sample application from Github.

    git clone https://github.com/pkvenu/botkit-watson-bot.git

  • Create a copy of the .env.template file and rename it to .env

    mv .env.template .env


The first file we'll look at is config.json. This contains high-level configuration information about your tutorial. This JSON file contains several properties you can declare about your tutorial:

  • RC_SERVER: Developer account - Sandbox or Production
  • RC_CLIENT_ID: Developer Account App Key.
  • RC_CLIENT_SECRET: Developer Account App Secret.
  • OAUTH_REDIRECT_URI: Redirect URI for 3-legged oAuth
  • WATSON_USERNAME: IBM Blumix Username
  • WATSON_PASSWORD: IBM Blumix Password
  • WATSON_URL: Personality Insight URL
  • WATSON_VERSION_DATE: Personality Insight Version Date
  • WATSON_VERSION: Personality Insight Version

In this step will install all dependencies using the code below:

npm install --save

This install two major packages:

  • botkit: Botkit is one of the most popular open-source toolkits for building bots. We will use the Glip adapter for the current example. "Glip" is a legacy name for RingCentral Team Messaging.
  • watson-developer-cloud: Watson Developer cloud contains the modules for Machine Learning and AI. We will be using the Personality Insight module in the current example.

Here we will instantiate the botkit adapater by calling the botkit.glipbot() module. The botkit constructure returns a controller objects. By attaching event handlers to the controller object, developers can specify what their bot should look and respond to, including keywords, patterns and various messaging and status events.

The controller object is then userd to spawn() bot instances that represents a specific bot identity and connection to RingCentral Team Messaging. Once spawned and connected to the API, the bot user will appear online in RingCentral Team Messaging, and can then be used to send messages and conduct conversations with users.

IBM Watson offers AI and Machine Learning services through its Bluemix cloud platform. To get started quickly with Watson and Bluemix, create a free account .

To instantiate the IBM Watson Personality Insight, we will use the Watson-developer-cloud npm and 'personality insight' module.

Now all basic dependencies are added. Lets get into the business logic.

Botkit provides the hears() function, which configures event handlers based on matching specific keywords or phrases in the message text.

We use the hears() method to lisit to the Watson: analyze keyword. Once the keyword is triggered we collect all post's for the current group and pass it to watson for analyze.

Watson will analyze all data and return back with top 5 personality insights.

Start the App

You can look inside the scripts section of the package.json for this repository to see you can use NPM to start the app. In your terminal, use:

npm start

Now login to the sandbox account https://app.devtest.ringcentral.com and add the bot by clicking on the + icon as shown below:

add RingCentral bot


Type watson: analyze. RingCentral will send all history in the group and respond back with top 5 personality insigths as shown in the image.