ringcentral-notification-integration-helper

RingCentral Engage Voice API js wrapper

Usage no npm install needed!

<script type="module">
  import ringcentralNotificationIntegrationHelper from 'https://cdn.skypack.dev/ringcentral-notification-integration-helper';
</script>

README

ringcentral-notification-integration-helper

Build Status Coverage Status

A module to help with communication with with RingCentral app in RingCentral notification app with UI.

APIs and uses

npm i ringcentral-notification-integration-helper -D
import { RingCentralNotificationIntegrationHelper } from 'ringcentral-notification-integration-helper'
// or
// const { RingCentralNotificationIntegrationHelper } = require('ringcentral-notification-integration-helper')

const app = new RingCentralNotificationIntegrationHelper()

// Notify RingCentral app that the integration can submit or not
// so RingCentral app can enable or disable submit button in RingCentral app UI
app.send({
  canSubmit: true // or false if can not submit
})

// Receive message from RingCentral app that
// user already click submit button so integration can proceed to submit.
app.on('submit', async function someSubmitFunction (e) {
  console.log(e.data.payload)
  // do something like submit
  const submitSuccess = await doSubmit()
  return {
    status: !!submitSuccess // true means submit success, RingCentral app will close integration window
  }
})

// Open window with proper params so user can do authorization
// in opened window by RingCentral, window.open would not work,
// check src/index.ts for detail
app.openWindow(windowUrl: string)

Test

npm i
npm run test

Real world demo

License

MIT