Cisco Webex Experience Management IVR Survey using Twilio
Prerequisites:
- Experience Management Account - To create a questionnaire and survey token
- Twilio account - To Create a Twilio Voice SIP Domain/Endpoint.
How does it work?
Experience Management uses Twilio for feedback collection over IVR. When a call is initiated through a Twilio SIP endpoint, Twilio will invoke Experience Management’s web application along with the survey token. Experience Management’s web application takes care of validating the token, prompting the survey questions, handling the survey, and then submit to the Experience Management.
Getting started in Twilio
Login to Twilio console and select Programmable Voice from the vertical menu on the left side of the view which will bring you to the Dashboard. Now navigate to SIP Domains/Endpoints.
-
Create a Twilio Voice SIP Domain/Endpoint. Provide a friendly name for you to identify and provide a global unique SIP Domain that is used to route the SIP traffic from your infrastructure over the public internet to the correct server hosted by Twilio in the cloud.
A SIP request uses a SIP URI such as the following: sip:alice@example.sip.twilio.com.
If you try to create a domain that already exists, you will receive an error. Creating subdomains of existing domains is permitted as long as you have already created the original domain. For example: foo.example.sip.twilio.com can only be created if you have already reserved example.sip.twilio.com.
Twilio processes the incoming request, it webhooks to your requested URL discussed next.
-
Under Call Control Configuration, you have to specify below Experience Management’s URLs (Refer to the screenshot below). Make sure you choose HTTP POST against configured webhooks.
A call comes in - https://cemvoice.azurewebsites.net/api/Twilio
Primary handler fails - https://cemvoice.azurewebsites.net/api/TwilioStatus
Screenshot of Call Control Configuration from Twilio:
Refer official Twilio doc for more info on this topic.
Getting started in Experience Management
This document assumes you know how to create a basic questionnaire. Now to make a call you need Token ID / Voice PIN. You need to create then survey token to get Token ID / Voice PIN, two ways to do it.
-
You can create the survey token through API.
-
You can create a survey token manually - Just to test and verify your Twilio setup you can use this method. If you are going to use a single token for all survey this will be helpful.
1. Create Survey Token through API
-
Create a survey token by using the Experience Management API (scroll to the section ‘Create Your First API Survey Token'). On Successful response, it will have the fresh token Id which was assigned by API. Authentication is needed for this request.
-
Now you need a voice pin (optional, when you need Voice PIN has been discussed next), let say your token is DM-21988. Convert the alphabets in your token into ASCII equivalent decimal and ignore the ‘-’ (hyphen) in the token. Ex: DM-21988 to 687721988, here ASCII decimal equivalent of D is 68, and M is 77.
-
Now you’ve two choices whether to use Token Id as it is or Voice PIN.
If you’re using Token Id, SIP URL format would be sip:DM-21988@example.sip.twilio.com
If you’re using Voice PIN, SIP URL format would be sip:687721988@example.sip.twilio.com
Voice PIN would be helpful if your use case something like a user calls your Twilio phone number to give the survey, and to authenticate they would have to punch in Voice PIN to continue the survey.2. Create Survey Token Manually
Log in to Experience Management and get your Token Id or Voice Pin from Token Settings. Follow the below steps to create a survey token if you don’t have one already.
-
Log in and click on the icon at the left top corner, and then swap to CX Setup.
-
Navigate to Invitations &Tokens, then select Token Settings.
-
You will see a list of tokens you’ve already created if it’s blank create one by clicking on the Create A Token button. Then select a questionnaire and click on Create. Now you can see the token ID.
-
If you need to get Voice pin, click on the wrench icon in the list against the token you’ve created/want to collect survey and then select IVR in the dropdown. You will see the Voice PIN.
-
How to make a call
Now you have Twilio SIP domain created by you and Token ID/Voice PIN. From any softphone where you can make a SIP call enter the SIP URL in the below format.
sip:<TokenID>@<your SIP sub domain>.sip.twilio.com or sip:<Voice PIN>@<your SIP sub domain>.sip.twilio.com
Example:
- sip:PP-12345@example.sip.twilio.com
- sip:808012345@example.sip.twilio.com