Twilio is a cloud communications Infrastructure as a Service (IaaS). It provides an API for making and receiving telephone calls, and sending and receiving text messages. To get started with Twilio, follow the steps below to gain access to their free sandbox service to send SMS text-messages. You can then configure the Twilio connector in Anypoint Studio with your API credentials.
To create a new Twilio account, go to https://www.twilio.com/try-twilio and register under "Try Twillio Free".
After you log in to your developer account, you see the Twilio dashboard. Note the Account SID and Auth Token values provided. Copy these credentials into the Twilio connector configuration menu in Anypoint Studio.
With a free developer account, you need to verify your SMS-enabled phone before you can send text messages to it.
Click Numbers in the Twilio website navigation to go to the Manage Numbers portion of their website.
Click Verify Numbers, and then click Verify a number. A new window opens as shown below.
Enter your cell phone number, and click Call this number. Follow the instructions provided to validate your number. You receive an automated phone call and need to enter an authorization code.
Finally, to send SMS-messages, you need to use the Sandbox "from" number. This phone number needs to be entered into the Twilio connector configuration menu in Anypoint Studio. This Sandbox number is also located on the Twilio dashboard, along with the Account SID and Auth Token.
|As you copy fields from the Twilio website to the Anypoint Studio connector configuration, be sure that you do not copy in additional leading/trailing characters or spaces. It is a good idea to visually confirm that your copy and paste functions did not capture surrounding characters.|
To use the Twilio connector in your Mule application, you must configure a global element that can be leveraged by all the Twilio connectors in your application. Note that using the Global Element creation wizard to define the Twilio configuration will only create part of the required XML construct (namely the outer twilio: config element with the provided accountSid and authToken attributes). In order to avoid a schema validation error when deploying the application, it is necessary to embed at a minimum the following construct: <twilio:http-callback-config />.
To do so, switch to the Configuration XML view of the application, locate the outer:twilio element and include the twilio:http-callback-config element as its direct child. For example:
<twilio:config name="Twilio" accountSid=“ABCedfg" authToken=“123sdfgh" doc:name="Twilio"> <twilio:http-callback-config /> </twilio:config>