ringcentral-engage-source
v0.2.0
Published
Framework to create `Dimelo SDK source` for RingCentral Engage Digital
Downloads
9
Maintainers
Readme
Engage Digital JavaScript Source SDK
Framework to create Dimelo SDK source
for RingCentral Engage Digital. Wiki about RingCentral Engage Digital Dimelo SDK source
Prerequisites
- Nodejs 8.10+/npm, recommend using nvm to install nodejs/npm.
- RingCentral Engage(Dimelo) account, request a demo.
Quick start
Let's start a simple RingCentral Engage source server .
# get the code
git clone [email protected]:ringcentral/engage-digital-source-sdk-js.git
cd engage-digital-source-sdk-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
Follow Step by step guide to create Dimelo SDK source in Admin console to prepare the source.
# create env file
cp .env.sample .env
# then edit .env, set proper setting according to the tip in .env
# run local dev server
npm start
Test source server
Save your source, your server will get request, you check the request log from console.
Use it as CLI tool
npx ringcentral-engage-source path-to-your-source-server-config.js
Use is as a module
Post message to channel
You can get channel realtime url and api token from channel setting page
import { postMessage } from 'ringcentral-engage-source'
const endpoint = CHANNEL_REALTIME_ENDPOINT
const secret = CHENNEL_API_TOKEN
function createMsg () {
const msg = {
action: 'messages.create',
params: {
actions: ['show', 'reply'],
id: '222',
body: 'hi there~',
thread_id: '34232',
author: {
id: 'uuuu',
firstname: 'John',
lastname: 'Doe',
screenname: 'John Doe',
created_at: new Date()
}
}
}
const result = await postMessage(msg, endpoint, secret)
console.log(result.data)
}
Real example
- Glip SDK source app: https://github.com/ringcentral/engage-digital-sdk-source-glip
- Reddit SDK source app: https://github.com/ringcentral/engage-digital-sdk-source-reddit
Write a config
Build and Deploy to AWS Lambda
Init a source server project with factory CLI tool
We have built-in CLI command to init a empty project from template: https://github.com/ringcentral/engage-digital-source-server-template-js.
npm i -g ringcentral-engage-source
ringcentral-engage-source-create my-app
License
MIT