0.1.3 • Published 5 years ago

ringcentral-personal-chatbot-js v0.1.3

Weekly downloads
4
License
MIT
Repository
-
Last release
5 years ago

ringcentral-personal-chatbot-js

RingCentral personal chatbot framework.

Quick start

Let's start a simple chatbot server and login to it with you sandbox glip account, and you account will auto respond to hello with Hi(any private message or message mentioned you).

# get the code
git clone git@github.com:rc-personal-bot-framework/ringcentral-personal-chatbot-js.git
cd ringcentral-personal-chatbot-js

# install dependecies
npm i

# start proxy server, this will make your local bot server can be accessed by RingCentral service
npm run ngrok

# will show
Forwarding                    https://xxxx.ap.ngrok.io -> localhost:6066
# Remember the https://xxxx.ap.ngrok.io, we will use it later

Login to developer.ringcentral.com and create Web-based App:

  • Application Type: Public
  • Platform Type: Browser-based
  • Carrier: accept the default values
  • Permissions Needed: Accounts, Contacts, Glip, Glip Internal, Read Accounts, Read Client Info, Read Contacts, Read Presence, Webhook Subscriptions
  • Set OAuth Redirect URI: Using your ngrok HTTPS URL from above, enter in the following value: https://xxxx.ap.ngrok.io/rc/oauth.

Click to create app

cp .env.sample .env
# then fill all required fields in .env, you can get client ID / secret from app setting

# run sample hello bot
npm start

# start client dev server
npm run c

Then visit https://xxxx.ap.ngrok.io to login, after auth, when someone talk to you with "hello"(any private message or message mentioned you), you will auto respond with "Hi".

Build and run in production

# build
npm run build

# run prodcution code
npm run p
# or
node -r dotenv/config bin/rcpf.js example-bots/hello.js

# proxy for production code
npm run ngrok-p

Use as CLI tool

I will as simple as this:

npx ringcentral-personal-chatbot-js your-bot-file.js

# check example-bots folders for bot examples, it is quite simple, you could just write your own.

Credits

It is based on the these projects, especially Tyler's work.

License

MIT