0.4.3 • Published 3 years ago

ringcentral-engage-client v0.4.3

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

RingCentral Engage Digital Client for JavaScript

Build Status Coverage Status

Simple JavaScript wrapper for RingCentral Engage API. api docs.

Installation

Node.js

npm i ringcentral-engage-client

Usage

Api token

https://developers.ringcentral.com/engage/digital/guide/basics/auth

import RingCentralEngage from 'ringcentral-engage-client'

const rc = new RingCentralEnage(
  process.env.RINGCENTRAL_ENGAGE_API_TOKEN,
  process.env.RINGCENTRAL_ENGAGE_SERVER_URL
)
let r = await rc.get('/1.0/roles').catch(console.log)
expect(r.data.records.length > 0).toBe(true)

Oauth

https://developers.ringcentral.com/engage/digital/guide/app-sdk/config

import RingCentralEngage from 'ringcentral-engage-client'

const ed = new RingCentralEngage({
  server: env.RINGCENTRAL_ENGAGE_DIGITAL_SERVER,
  authUrl: env.RINGCENTRAL_ENGAGE_DIGITAL_APP_AUTH_URL,
  tokenUrl: env.RINGCENTRAL_ENGAGE_DIGITAL_APP_TOKEN_URL,
  clientId: env.RINGCENTRAL_ENGAGE_DIGITAL_APP_KEY,
  clientSecret: env.RINGCENTRAL_ENGAGE_DIGITAL_APP_SECRET,
  redirectUri: env.RINGCENTRAL_APP_SERVER + '/oauth'
})
await ed.authorize({ code })
let userInfo = await ed.get('/1.0/users/me')
userInfo = userInfo.data
const id = userInfo.id.toString()

Check https://github.com/ringcentral/engage-digital-app-sdk-demo-app as example

Test

cp .sample.env .env
# edit .env fill your server and spi key
npm run test

Credits

Based on Tyler's https://github.com/tylerlong/ringcentral-js-concise.

License

MIT

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0-beta.0

3 years ago

0.3.0

3 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago