Twilio Connector

Twilio is a cloud communications Infrastructure as a Service (IaaS).

The Twilio platform serves APIs for text messaging, VoIP, and voice calls. The Anypoint Connector for Twilio (Twilio Connector) provides connectivity to the Twilio text messaging API.

This connector provides an API for sending and receiving text messages. To get started with Twilio, follow the steps below to gain access to the free Twilio sandbox service to send SMS text messages. You can configure the Twilio connector in Anypoint Studio with your API credentials.

Create a New Twilio Account

To create a new Twilio account, go to https://www.twilio.com/try-twilio and register under "Try Twilio Free".

Obtain API Credentials

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.


Verify a SMS-Enabled Phone

  1. With a free developer account, you need to verify your SMS-enabled phone before you can send text messages to it.

  2. Click Numbers in the Twilio website navigation to go to the Manage Numbers portion of their website.

  3. Click Verify Numbers, and then click Verify a number. A new window opens as shown below.

  4. 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.

  5. 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.

Configuring the Global Element

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 />

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub