Create a Glip survey bot without coding

Tyler Liu
RingCentral Developers
5 min readMay 18, 2018

In daily life, we often need to do surveys. Some are very formal surveys: you spread questionnaires and collect them back to get aggregated result. Some are informal surveys: “Raise your hand if….”. Nowadays, more and more surveys are being conducted online. You will get a lot of online survey websites if you search Google for “survey”.

I was always wondering: isn’t it cool to create a Glip bot to do surveys? Last week I finally got some spare time and started working on a Glip survey bot. I faked the following survey questions for testing:

I expect that at the end of the survey, I could get an excel sheet like below:

For the first quick and dirty version of the bot, I hard-coded all the survey questions into my code. Soon I realized that it was a bad idea, because every time I have a new set of survey questions, I need to update the code. And since other people are not familiar with my code or are reluctant to learn my code, nobody else will use the bot other than myself.

Can I enable people to create a survey bot without coding?

I spent hours and I finally managed to do it! Here is the project: https://github.com/tylerlong/glip-survey-bot Let’s go through the process of setting up the bot together.

Prerequisites

Although no coding work is required, it does require you to have some programming knowledge:

  • Node.js installed on your laptop/server
  • Yarn installed on your laptop/server
  • You know markdown format
  • You know how to use command line
  • You have a RingCentral developer account (free registration)

Get the source code

You can get the code via git:

git clone git@github.com:tylerlong/glip-survey-bot.git

If you don’t use git, you can download the code here and extract it.

Create a RingCentral app

Get a free RingCentral developer account if you don’t already have one.

Login your RingCentral developer account.

Create a new app:

Step #1:

Step #2:

Step #3:

For “OAuth Redirect URI”, set an example URI because we will change it later.

Edit the .env file

Now let’s go back to the downloaded source code. Cd to the root folder of the source code, execute:

cp .env.sample .env

Open .env with your favorite editor:

RINGCENTRAL_SERVER_URL=https://platform.devtest.ringcentral.com
RINGCENTRAL_TOKEN=<…We will generate a token later…>

There are two lines. Set the first line as shown above.

For RINGCENTRAL_TOKEN, we will use a tool to generate it.

Download & install RingCentral Token Generator.

Generate the token:

The two text fields are Client ID & Client Secret, you can get them from your RingCentral app dashboard.

In this step, a redirectUri is generated. If you still remember, we set the RingCnetral app’s redirectUri to https://example.com. Now let’s change it to the uri the tool just generated:

Now go to the “Bot” tab of the RingCentral app, click “Add to Glip”:

Click the “Authorize” button, and go back to the RingCentral Token Generator tool:

You can see that token has been generated! Let’s copy the compressed version and paste it to the .env file.

Now we have finished editing the .env file!

Create your survey questions

Edit survey.md file in the source code, and replace the existing survey questions with yours. The survey.md file look like below:

The rule is simple:

  • heading 1 is the survey topic
  • paragraph is some information the bot will send to user
  • heading 2 is a survey question
  • bullet/ordered list contains the answer options

NOT all markdown syntaxes are supported. For example, in the screenshot above we have

### heading 3

In Glip it will be displayed as it is. Because Glip doesn’t support rendering of headings.

You can leave it untouched if you are OK with the existing survey questions for testing purpose. You can change the questions later, let’s go ahead after you are done.

Start the bot

yarn install

yarn start

Test the bot

Use your RingCentral sandbox account to login https://glip.devtest.ringcentral.com/

Search for your bot by name, if you use the same name as the screenshot above, it is “my-awesome-survey”.

Talk to the bot:

You can see that it works like a charm. At the end you can download the survey report in CSV format.

You can add this bot to a chat group, and ask group members to take the survey. But if there are more than just you and the bot, you will need to mention the bot:

Go production!

A newly created RingCentral app is in sandbox mode. Sandbox mode is great for testing purpose. But if you want to share the bot with your friends/colleagues, you need to graduate your app to production first.

If you have any questions regarding graduating your app or have questions about RingCentral Glip bots, please join RingCentral Developers on Glip and we are there to help!

That’s all. Thanks!

--

--