Orbita can be integrated with Twilio to make phone calls or send SMS with the help of the Twilio node in Experience Designer. The URL of the TwiML used to create the phone call or msg.payload can contain the text of the SMS message.
Prerequisites
Registered Twilio account.
Twilio powered Phone number.
Integrating Orbita with Twilio
If you configure the node to make a phone call, provide a TwiML URL that is publicly accessible. You can add the receiving phone number in the To field, in the Twilio node, so that Twilio will send the text message(s) or make a phone call. If the number is left blank, set it to use msg.topic.
Setting credentials
There are two options in the Credentials drop-down.
Use global credentials. Contact orbitasupport@orbita.ai to get details on the environmental variables used to configure global credentials.
Use local credentials. Use this option to give details of your Twilio account in the node. The recipient(s) will receive messages/phone calls from your Twilio phone number.
Adding a Twilio account
To add a new Twilio account:
Click Edit in the Twilio node. A new dialog box appears.
Enter the details from your Twilio account.
Go to https://www.twilio.com/ and click on the console button in the right top corner of the web page and log in to your Twilio account or click Console and log in.
On the console page, you can get the Account SID and Auth Token.
You can see your Twilio powered phone number on this page. https://www.twilio.com/console/phone-numbers/incoming
Setting output
There are three types of Output.
SMS. Lets the Twilio node send a text message to the phone number.
Call. Lets the Twilio node make a phone call to the phone number.
WhatsApp. Lets the Twilio node send a message via WhatsApp.
To. The phone number to which a Call or SMS or WhatsApp should be made or sent respectively. If the number is left blank, use msg.topic in this field.
URL. Phone calls that you make from a Twilio number to an outside number are controlled using TwiML. The initial URL for the call is provided as a parameter to the Twilio REST API request, which you make to initiate the call.
See, https://www.twilio.com/console/voice/twiml/overview to learn more about the URL.
Name. Name of the node.
Example flow
The following flow shows how to integrate Twilio with Experience Designer.
Two different flows are given in the above example. The first flow creates an endpoint URL that can be used in the Twilio node. The second flow triggers a call when an authenticated user says “help”.
http node
Creates an http end-point for creating web services.
Method. Set to GET.
URL. Enter the XML file that will be created.
Function node
The following code is usable with parameters like msg.payload, statusCode, and msg.header. Push the XML code in msg.payload for this example. This XML code sends a short message and record the caller’s voice post message.
msg.payload='<?xml version="1.0" encoding="UTF-8"?><Response><Say voice="woman">Please leave a message after the tone.</Say><Record maxLength="20" /></Response>';msg.statusCode=200;msg.headers = {"content-type": "application/xml"};return msg;
http response node
Sends responses back to requests that were received from the HTTP input node.
Intent Request node
Triggers the flow when help is called by the user.
Function node
Checks whether the user is an authenticated user.
Say node
Configure the bot to say something based on the output from the attached function node.
Twilio node
The URL will be the local endpoint that was created in the first section.
http://127.0.0.1/oeapi/twilioml.xml
In the example, when a valid user triggers the help intent, Twilio reads TwiML instructions at that URL. TwiML is already instructed to respond in an automated voice “Please leave a message after the tone” and start the recording for 20 seconds in the function node.
Video Content
https://cdn.orbita.cloud/assets/orbita/ivr/twilio.mp4