Skip to content
Concise JavaScript SDK for RingCentral.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Support batchGet Dec 17, 2018
test
.ackrc
.babelrc
.editorconfig Add config files Jan 3, 2018
.gitignore Minor change Nov 16, 2018
.sample.env
.travis.yml
README.md
package.json
webpack.config.babel.js
yarn.lock Upgrade dependencies Feb 18, 2019

README.md

ringcentral-js-concise

npm version

Concise JavaScript SDK for RingCentral.

Installation

Node.js

yarn add ringcentral-js-concise

or CDN

<script src="https://unpkg.com/axios@0.18.0/dist/axios.min.js"></script>
<script src="https://unpkg.com/ringcentral-js-concise@0.5.4/dist/ringcentral.js"></script>

ringcentral-js-concise depends on axios. With the code above you will have a global variable named RingCentral.default.

Usage

import RingCentral from 'ringcentral-js-concise'

(async () => {
  const rc = new RingCentral(process.env.RINGCENTRAL_CLIENT_ID, process.env.RINGCENTRAL_CLIENT_SECRET, process.env.RINGCENTRAL_SERVER_URL)
  await rc.authorize({ username: process.env.RINGCENTRAL_USERNAME, extension: process.env.RINGCENTRAL_EXTENSION, password: process.env.RINGCENTRAL_PASSWORD })
  const r = await rc.get('/restapi/v1.0/account/~/extension/~')
  const extension = r.data
  console.log(extension)
})()

Fully working demo project

Get & set token

const token = rc.token() // get
rc.token(token) // set

Auto refresh token

Token expires. You can call rc.refresh() to refresh token. But normally you don't need to do that because this library will refresh for you if access token expired.

HTTP Methods: get, post, put, delete

HTTP Methods

Send SMS

Send SMS

Send Fax

Send Fax

Batch Get

Batch Get

More examples

Please refer to test cases.

PubNub

import PubNub from 'ringcentral-js-concise/dist/pubnub'

Check the PubNub sample code

Use custom axios Instance

The underlying HTTP library is axios.

The 4th parameter of RingCentral's constructor allows you to specify a custom axios Instance:

const rc = new RingCentral(clientId, clientSecret, server, axiosInstance)

The 4th parameter is optional, if you omit it, a default axiosInstance with be used.

Test

mv .sample.env .env
edit .env
yarn test
You can’t perform that action at this time.