ringcentral-js-concise

0.8.2 • Public • Published

Deprecated

This is just a personal project. Users should use RingCentral Extensible SDK instead.

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

Readme

Keywords

none

Package Sidebar

Install

npm i ringcentral-js-concise

Weekly Downloads

17

Version

0.8.2

License

MIT

Unpacked Size

639 kB

Total Files

10

Last publish

Collaborators

  • tylerlong