Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This repository contains the guide to walk developers through the process of creating a Glip bot using the ringcentral-ai-bot framework.

License

NotificationsYou must be signed in to change notification settings

ringcentral-tutorials/ringcentral-ai-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

148 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project contains the code and resources needed for developers to build and deploy a voicemailassistant bot on top of the RingCentral Glip messaging platform. The bot contained within thisframework can, with a user's permission, monitor a user's voicemail for incoming messages, andthen alert the user via a Glip message of a new voicemail. In addition, it can interface withGoogle's speech-to-text APIs to transcribe the incoming message, analysis with Google's cloud AI(Cloud Natural Language API) and post the text and result to user as well.

The bot contained within is meant to be used in conjunction with adetailed tutorial on building botson Glip. As a result, the bot intentionally lacks some functionality that ideally developerswould implement by completing the corresponding tutorial.

Features

Bot

The bot provided by this project is capable of responding to the following command:

  • monitor - enable monitoring of the current user's voicemail messages.

When a voicemail is received, the bot will post a transcript of the voicemail to the user, along with some high-level analysis of the contents of the voicemail.

Future Framework

This bot is includes core bot features that are intended to be extracted to a Glip bot framework that seeks to eliminate the need to develop a lot of the mundane functions necessary to support a bot that is easily deployed, and authorized to access a user's account. Here are some of the functions this framework will provide to developers:

  • Implements an OAuth flow for adding bots to a Glip organization.
  • Implements an OAuth flow for prompting users to grant the bot permission to access their RingCentral account data.
  • Automatically refreshes event subscriptions before they expire.
  • Provides a simple framework for developers to implement new commands and functionality.
  • Persists and manages authentication tokens for users of the bot.

Setup and Installation

A detailed guide for getting the bot up and running is provided in thebot's tutorial. For those developers more familiar with RingCentral wishing to dive right in, the following instructions will help:

Prerequisites

  • Node.js >= 8.10
  • Yarn
  • a Google API account with asaved Google credentials file, note that you can still run local demo to see how it works without Google account/credential, but with fake demo data.

Setup the Project

git clone git@github.com:ringcentral-tutorials/ringcentral-ai-bot.gitcd ringcentral-ai-botyarn install

Create Your Proxy

If you are developing on your local machine, you may need to create a proxy/tunnel to the outside world so that your bot can receive webhooks properly. You can do this easily by executing the following command in a separate terminal:

cd ringcentral-ai-botyarn proxy

Make note of the ngrok HTTPS URL for use later.

Create the Apps

Login todeveloper.ringcentral.com and create two different apps using the parameters below.

Server/Bot App

  • General Settings
    • Choose a name and description you prefer.
  • App Type and Platform
    • Application Type: Public
    • Platform Type:Server/Bot
    • Carrier:accept the default values
  • OAuth Settings
    • Permissions Needed: All of them (ReadContacts, ReadMessages, ReadPresence, Contacts, ReadAccounts, SMS, InternalMessages, ReadCallLog, ReadCallRecording, WebhookSubscrip
      tions, Glip)
    • OAuth Redirect URI: Using your ngrok HTTPS URL from above, enter in the following value:https://1234abcd.ngrok.io/oauth-bot

Web-based App

  • General Settings
    • Choose a name and description you prefer.
  • App Type and Platform
    • Application Type: Public
    • Platform Type:Browser-based
    • Carrier:accept the default values
  • OAuth Settings
    • Permissions Needed: All of them (ReadContacts, ReadMessages, ReadPresence, Contacts, ReadAccounts, SMS, InternalMessages, ReadCallLog, ReadCallRecording, WebhookSubscriptions, Glip)
    • OAuth Redirect URI: Using your ngrok HTTPS URL from above, enter in the following value:https://1234abcd.ngrok.io/oauth-user

Edit Your Config File

Make a copy of the sample.env file.

cp .sample.env .env

Then edit the.env file and populate it with the parameters unique to your install.

Start the Server

Finally, start the server:

yarn dev

Test the Bot

Login tohttps://app.devtest.ringcentral.com, find the bot by searching its name. Talk to the bot, and follow the its instructions.

Building and Running Your Bot in Production

# install pm2 first if you wanna use pm2yarn global add pm2# or `npm i -g pm2`# buildyarn build# run production serveryarn prod-server# use pm2pm2 start bin/pm2.yml

Building and Deploying to AWS Lambda

AWS Lambda with API Gateway and DynamoDB would give us a flexible way to deploy the bot.

Be aware that AWS LambdaONLY works in linux on an x64 architecture. Therefore, some dependencies will need to be prebuilt and uploaded to Lambda on a linux x64 instance. You could do this in ci or any linux server/destop env.

Get an AWS account, createaws_access_key_id andaws_secret_access_key and place them in~/.aws/credentials, like this:

[default]aws_access_key_id =<your aws_access_key_id>aws_secret_access_key =<your aws_secret_access_key>

For more information, refer tohttps://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html

cp lambda/serverless.sample.yml lambda/serverless.yml

Editlambda/serverless.yml, and make sure you set the proper name and required env.

# you can define service wide environment variables hereenvironment:NODE_ENV:production# ringcentral apps## botsRINGCENTRAL_BOT_CLIENT_ID:RINGCENTRAL_BOT_CLIENT_SECRET:## userRINGCENTRAL_USER_CLIENT_ID:RINGCENTRAL_USER_CLIENT_SECRET:## commonRINGCENTRAL_SERVER:https://platform.devtest.ringcentral.comRINGCENTRAL_BOT_SERVER:https://xxxx.execute-api.us-east-1.amazonaws.com/default/poc-your-bot-name-dev-bot## for google cloud api crendential pathGOOGLE_APPLICATION_CREDENTIALS:path/to/google-credential.json# dbDB_TYPE:dynamodbDYNAMODB_TABLE_PREFIX:rc_ai_bot1DYNAMODB_REGION:us-east-1

Deploy to AWS Lambda withyarn deploy

# Run this cmd to deploy to AWS Lambda, full build, may take more timeyarn deploy## watch Lambda server logyarn watch## update functionyarn update## update without build, fast update, no rebuildyarn u
  • Create API Gateway for your Lambda function, shape ashttps://xxxx.execute-api.us-east-1.amazonaws.com/default/poc-your-bot-name-dev-bot/{action+}
  • Make sure your Lambda function role has permission to read/write dynamodb(Set this from AWS IAM roles, could simply attachAmazonDynamoDBFullAccess andAWSLambdaRole policies to Lambda function's role)
  • Make sure your Lambda function's timeout more than 5 minutes
  • Do not forget to set your RingCentral app's redirect URL to Lambda's API Gateway URL,https://xxxx.execute-api.us-east-1.amazonaws.com/default/poc-your-bot-name-dev-bot/bot-oauth for bot app,https://xxxx.execute-api.us-east-1.amazonaws.com/default/poc-your-bot-name-dev-bot/user-oauth for user app.

Editing This Tutorial

This repo also serves as a tutorial that can be viewed online athttps://ringcentral-tutorials.github.io/ringcentral-ai-bot. If you would like to contribute to the documentation effort, clone this repository and run the documentation server locally via the following commands:

# install depsyarn# start local docs serveryarn docs

Then visithttp://localhost:8888 to check the tutorial

You can editdocs/tutorial/index.jade, docs will auto updatedocs/index.html, refreshhttp://localhost:8888 to see the change.

Credits

Documents & Reference

License

MIT

Copyright

© 2018 RingCentral, Inc.

About

This repository contains the guide to walk developers through the process of creating a Glip bot using the ringcentral-ai-bot framework.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp