Connect the RingCentral API in the Engage Voice IVR Studio

Embbnux Ji
RingCentral Developers
4 min readFeb 4, 2021

The RingCentral Engage Voice IVR Studio is a drag-and-drop interface that helps customers to build a visual representation of IVR actions. With the IVR Studio, an admin can create IVR logics without coding. So how do you connect a third party API to the Engage Voice IVR Studio. In this article, we will show you how to Connect the RingCentral API in IVR Studio.

Prerequisites

  1. Basic knowledge about Engage Voice IVR designer
  2. A free RingCentral Developer account to create a RingCentral app (type : private)

Step 1: Create IVR

Create a IVR by following this document. We also need to assign a number, so we can test it.

After the IVR is created, we can see a IVR studio option:

Step 2: IVR Studio

There are lots of nodes at the left bar of the IVR Studio. We can just drag them into the background, and by doing a long click we can drag at the plus icon to connect the nodes

Step 3: Authorization RingCentral API

We will use WWW node to send the authorization request to the RingCentral API. Drag a www node into the background, and double click to the edit the properties:

Since we don’t have a UI to authorize — we will need to use the password grant type (we need to select private app when creating the RingCentral app).

We also need to set HTTP Headers as required by the RingCentral auth API

The value of the Authorization header is base64 encoded value of your_rincentral_app_client_id:your_ringcentral_app_secret_id

Step 3: Save access token

After we get an authorization response from the WWW node, we need to save it.

Drag a Scripting node and connect it after the WWW node, then double click to edit it.

Add the following code into the Scripting node:

var data = ivr.getData('AuthorizationRC');
var authResponseData = JSON.parse(data);
var responseBody = JSON.parse(authResponseData.response_body);
ivr.putData('$rcAccessToken', responseBody.access_token);
var rcAuthorization = responseBody.token_type + ' ' + responseBody.access_token;
ivr.putData('$rcAuthorization', rcAuthorization);

We save the access token into the $rcAccessToken key, and an authorization header into the $rcAuthorization key.

Step 4: send SMS by RingCentral API

We need another WWW node to send the SMS request. Just drag a new node, and edit it:

We also need to set the authorization header, this is different with the Authorization API.

We read the authorization value from the$rcAuthorization that we set in the upper node.

Step 5: Revoke token

After we finish the API request, we need to revoke token. Just drag a WWW node after the request node.

The Authorization value will be the same as what we did in the authorization node.

Step 6: Router

After we finish all the requests, we need to route the call to some number or call queue.

Drag a Router node at the end:

So after we have finished all the nodes, they should be connected as pictured below:

Conclusion

In this article, we introduced how to authorize and request the RingCentral API with the Engage Voice IVR Studio. You can also use it as an example when you request third party APIs in the Engage Voice IVR Studio. Hopefully this article was helpful.

Please let us know what you think by leaving your questions and comments below. To learn even more about other features we have make sure to visit our developer site and if you’re ever stuck make sure to go to our developer forum.

Want to stay up to date and in the know about new APIs and features? Join our Game Changer Program and earn great rewards for building your skills and learning more about RingCentral!

--

--