Skip to main content

Twilio Component

Send SMS messages through Twilio

Component key: twilio

Description#

Twilio is a platform that allows you to send SMS text messages. You can use the Twilio component to send messages to your end users or to your team.

Twilio Connections#

Twilio API Key Connection#

This component authenticates with Twilio using API key/secret pairs that can be generated from Twilio's app console. To create a Twilio API key and secret pair:

  • Go to the Twilio console
  • On the top-right of the screen click Account -> API Keys & Tokens
  • Select Create API Key
  • Give your key a name and select Standard for Key type
  • Take note of the API key's SID and Secret - you will enter those into Prismatic in a moment

Now, when you create an integration that uses Twilio, a "Twilio API Key Connection" will automatically be generated. Enter your API Key SID (starts with "SK..."), and its Secret. Go back to your Twilio console to find your Account SID (starts with "AC..."), and enter that as well.

InputNotesExample
Input
Account SID
string
/ Required
Notes
Your account SID (starts with AC)
Example
ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input
API Key SID
string
/ Required
Notes
An API Key SID (starts with SK)
Example
SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input
API Key Secret
string
/ Required
Notes
The API secret that was generated when an API key was created
Example
 

Twilio Auth Token Connection#

When you create a Twilio account, an Account String Identifier (Account SID) and Auth Token are generated. You can use the account SID and auth token to authenticate with Twilio and to send SMS messages.

Consider API Keys instead

For security reasons, we recommend using an API Key Connection instead. API keys can be revoked and auth tokens generated using API keys are short-lived.

InputNotesExample
Input
Auth Token
string
/ Required
Notes
Can be found on https://console.twilio.com/
Example
 
Input
Account SID
string
/ Required
Notes
Your account SID (starts with AC)
Example
ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Triggers#

Webhook#

Trigger for handling webhooks from Twilio | key: webhook

You can configure a Twilio webhook to send information to a Prismatic webhook URL upon sending a text message.

The webhook configuration takes place when adding/updating contact phone numbers.

Output Example Payload#

{  "payload": {    "headers": {      "accept": "*/*",      "Content-Type": "application/json; charset=UTF-8",      "User-Agent": "TwilioProxy/1.1",      "Host": "hooks.example.prismatic.io"    },    "body": {},    "rawBody": {      "data": { "type": "Buffer", "data": [69, 120, 97, 109, 112, 108, 101] }    },    "queryParameters": None,    "webhookUrls": {      "Flow 1": "https://hooks.example.prismatic.io/trigger/EXAMPLEGbG93Q29uZmlnOmRlNmNmNDMyLTliNWMtN0005NDMxLTRmYzA4ZjViODgxOA=="    },    "webhookApiKeys": { "Flow 1": ["abc-123"] },    "customer": {      "externalId": "customer-example-external-id",      "name": "John Doe"    }  }}

Actions#

Send SMS#

Send an SMS message | key: sendSMS

InputNotesExample
Input
From
string
/ Required
Notes
The SMS sender's phone number.
Example
5555551234
Input
Message
string
/ Required
Notes
The message body of the SMS message.
Example
Hello from Prismatic!
Input
To
string
/ Required
Notes
The SMS recipient's phone number.
Example
5551234567
Input
Connection
connection
/ Required
Notes
 
Example
 

Output Example Payload#

{  "data": {    "accountSid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",    "apiVersion": "2010-04-01",    "body": "body",    "dateCreated": "2010-04-01T00:00:00.000Z",    "dateSent": "2010-04-01T00:00:00.000Z",    "dateUpdated": "2010-04-01T00:00:00.000Z",    "direction": "outbound-api",    "errorCode": null,    "errorMessage": null,    "from": "+15017122661",    "messagingServiceSid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",    "numMedia": "0",    "numSegments": "1",    "price": null,    "priceUnit": null,    "sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",    "status": "sent",    "subresourceUris": "",    "to": "+15558675310",    "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"  }}