2.1.5 • Published 2 years ago

ringcentral-chatbot v2.1.5

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

RingCentral chatbot framework for JavaScript

Philosophy

  • Let developers focus on business logic instead of RingCentral/Glip Platform implementation details

Supported features

  • Bot token management
  • Bot WebHook management
  • Remove & re-add bot
  • Deploy to AWS Lambda
  • Update bot name and avatar
  • Bot join & leave group

Quick Start tutorials

We recommend you to finish reading/watching at least one of the tutorials above before reading on.

Create a RingCentral app

Click the link below to create a RingCentral app quickly:

Create Bot App

Do remember to change redirect uri from https://<chatbot-server>/bot/oauth to the real uri. If you don't have a public uri, leave that field blank.

Setup database

The first time you setup the bot, the database is empty, you need to create tables.

There is an easy way:

curl -X PUT -u admin:password https://<bot-server>/admin/setup-database

Migrate database

If you update the SDK from an early version, it might not work because the database schema has changed.

In such case, you can migrate the database:

curl -X PUT -u admin:password https://<bot-server>/admin/migrate-database

This command will smartly check your database and add new fields/tables if necessary.

Maintain

"Maintain" is useful in the following cases:

  • If for reason bot server changed, you need to re-setup WebHooks
  • You bot server was down for quite a while and your WebHooks have been blacklisted
  • There is orphan data in database

You can "maintain" to resolve the issues above:

curl -X PUT -u admin:password https://<bot-server>/admin/maintain

It is recommended that you create a cron job to run this command daily.

Diagnostic

Sometimes there are issues and you don't know what happened. This framework provides interfaces for diagnostic:

curl -X GET -u admin:password https://<bot-server>/admin/dump-database
curl -X GET -u admin:password https://<bot-server>/admin/list-subscriptions

To enable verbose logging, please define environment variable RC_VERBOSE_LOGGING with string value "true".

Update token

curl -X PUT -u admin:password https://<bot-server>/admin/update-token?id=<bot-extension-id>&token=access-token'

Hidden commands

The following commands are considered "hidden" or "easter eggs":

  • __rename__ <newName>: rename bot to newName
  • __updateToken__ <access_token>: update bot access token to access_token
  • A message with text __setAvatar__ and an attached image file: set bot avatar to the attached image

Advanced topics

About graduation

In order to graduate a RingCentral app, you need to invoke each API endpoint used in your app at least 5 times.

In order to to meet this requirement quickly, you can invoke API endpoints explicitly in code, for example:

await bot.rc.get('/restapi/v1.0/account/~/extension/~')

Advanced Demo bots

  • Glip Crontab Chatbot
    • Allow Glip users to create cron jobs to send notifications
    • Try it
    • By reading its source code, you will get how to handle messages from users and how to reply.
  • Glip RC Assistant Chatbot
    • Allow Glip users to query/edit their RingCentral data via Glip.
    • Try it
    • It is a demo for integrating Glip chatbot with RingCentral platform.
  • Glip Google Drive Chatbot
    • Allow Glip users to monitor their Google Drive events.
    • Try it
    • It is a demo for integrating Glip chatbot with a third party service (Google Drive)
    • It is also a demo for chatbot skills

Notes

  • AWS Lambda connects AWS RDS issue
    • If you create an RDS manually and let it create a new security group for you.
      • By default, the security group only allows inbound traffic from your current laptop's public IP address
      • AWS Lambda by default cannot access the newly created AWS RDS
      • We need to update security group to allow inbound traffic from 0.0.0.0/0
  • AWS Lambda and await issue
    • AWS Lambda is stateless and it won't keep a background runner
    • So if your code is async, DO remember to await. Otherwise that code will not be executed before Lambda invocation terminates
    • I forgot to await, a weird phenomenon was: whenever I issued a command, I always got reply of previous command
  • AWS Lambda global code dead-lock issue
    • Do NOT invoke lambda functions in global code outside of handlers
    • I tried once and it seemed to case dead-lock. Lots of requests which causes 429 error and database connection exhausted
      • In global code I did axio.put('https://<bot-server>/admin/maintain') and it caused dead-lock

Todo

  • send api to change presence, let bot user to be online
2.1.4

2 years ago

2.1.3

2 years ago

2.1.5

2 years ago

2.0.0

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

1.11.0

3 years ago

1.10.0

3 years ago

1.9.0

3 years ago

1.8.10

3 years ago

1.8.11

3 years ago

1.8.12

3 years ago

1.8.9

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.9

3 years ago

1.7.8

3 years ago

1.7.7

3 years ago

1.7.6

3 years ago

1.8.8

3 years ago

1.8.7

3 years ago

1.8.6

3 years ago

1.8.5

3 years ago

1.8.4

3 years ago

1.8.3

3 years ago

1.7.5

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

4 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago

0.5.4

6 years ago

1.0.0

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.8

6 years ago

0.4.7

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago