Last modified June 30, 2017 by Shelly Wolfe

Twilio

Twilio iconTwilio is a cloud communications platform that enables companies to integrate phone call and SMS capabilities into their app. The Twilio Adaptor enables you to send text and picture messages to your Swrve users based on user actions in the app and then use the returned message delivery status events to trigger further actions in Amplify.

Supported Actions

The Twilio Adaptor supports the following actions:

Outbound Actions

  • Send SMS or MMS message

Inbound Actions

  • Use SMS deliverability status events to trigger other Amplify actions

Use Cases

Send SMS or MMS Message

Send SMS or MMS messages in response to a user’s real-time action in the app. For example, send a booking confirmation or purchase receipt if a customer opts into receiving them via text message.

There are two main steps involved in sending an SMS or MMS message via the Twilio adaptor:

  1. Create a custom event in the Swrve SDK for the user action you want to use to send a message; for example, booking_confirmed.
  2. Create an Amplify rule that is triggered on receipt of the designated event and uses the Send Message action to send an SMS or MMS message. (Note: Sending images is currently only possible in the US and Canada.)

Take Action on SMS Deliverability Status

After sending an SMS, use the SMS deliverability status events as triggers for other Amplify actions. For example, send an email confirmation if a message status is Undelivered.


Adaptor Configuration

Step 1: To access the configuration settings, on the Twilio Adaptor card, click Configure.

Step 2: Complete the following fields as required:

Field Description
Account SID Your Twilio account SID that is used as the username for authentication purposes. To view this value, log in to your Twilio dashboard, under Account Summary.
Auth Token Your Twilio auth token that is used as the password for authentication purposes. To view this value, log in to your Twilio dashboard, under Account Summary.

Step 3: To save the configuration settings, click Save.

After you click Save, the status of the Adaptor changes to Active and the Deactivate button is available.


Rule Configuration

This section describes the fields that are included when creating a new rule. For most fields, you have the option to manually enter the value or to select a user property from the list to have Swrve automatically populate the value when the rule is processed. For more information on rules, see Creating Amplify Rules.

Send Message

Use the Send Message action to send a text or picture message to a customer from Twilio. Complete the following fields to include the values required to send the message.

Field Required / Optional Description
Message Body Required The text of the message you want to send, limited to 1600 characters. You must include either the Message Body or MediaURL.
Message Recipient Phone Number Required The destination phone number. Format with a ‘+’ and country code, for example, +16175551212 (E.164 format).
Sender Number Required A Twilio phone number (in E.164 format) or alphanumeric sender ID enabled for the type of message you wish to send. Phone numbers or short codes purchased from Twilio work here. You cannot (for example) spoof messages from your own cell phone number.
Messaging Service SID Optional The 34 character unique ID of the Messaging Service you want to associate with this message. Set this parameter to use the Messaging Service Settings and Copilot Features you have configured in Twilio. When only this parameter is set, Twilio uses your enabled Copilot Features to select the From phone number for delivery.
MediaURL Optional To send an MMS message, include the URL of the media you wish to send. gif, png and jpeg content is currently supported and will be formatted correctly on the recipient’s device. Other types are also accepted by the Twilio API. The media size limit is 5MB. To send more than one image in the message body, provide multiple MediaURL values. You may include up to 10 MediaURLs per message. You must include either the Message Body or MediaURL.

Inbound Actions

When an action triggers the above rule, the SMS parameters include an API request to Twilio that results in Twilio sending any changes to the SMS status back to Swrve as events. You can then use those events as triggers for other actions in Amplify. The available events are:

Status Description
black_listed_error Sent when a user replies STOP to the SMS message, as a means of tracking unsubscribes.
Delivered Twilio has received confirmation of message delivery from the upstream carrier, and, where available, the destination device.
Failed The message could not be sent. This can happen for various reasons including queue overflows, account suspensions and media errors (in the case of MMS).
Queued The API request to send a message was successful and the message is queued to be sent out. This is the initial status when you are not using a Messaging Service.
Sent The message was successfully accepted by the nearest upstream carrier.
Undelivered Twilio has received a delivery receipt indicating that the message was not delivered. This can happen for a number of reasons including carrier content filtering, availability of the destination device, and so on.