GithubHelp home page GithubHelp logo

isabella232 / engage-digital-source-sdk-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ringcentral/engage-digital-source-sdk-js

0.0 0.0 0.0 62 KB

Framework(js) to create Dimelo SDK source for RingCentral Engage Digital

License: MIT License

JavaScript 99.18% Shell 0.82%

engage-digital-source-sdk-js's Introduction

Engage Digital JavaScript Source SDK

Build Status

Framework to create Engage Digital channel SDK channel for RingCentral Engage Digital. Wiki about RingCentral Engage Digital channel SDK channel

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

docs/direct-use.md

Post message to channel

You can get channel realtime url and api token from channel setting page, post new message to the channel.

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

Write a config

docs/write-a-config.md

Build and Deploy to AWS Lambda

docs/deploy-to-lambda.md

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

engage-digital-source-sdk-js's People

Contributors

grokify avatar ylecuyer avatar zxdong262 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.