Twilio Component

Send SMS messages through Twilio
Component key: twilio#
DescriptionTwilio 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 ConnectionThis 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.
Input | Notes | Example |
---|---|---|
Input Account SID string / Required accountSid | Notes Your account SID (starts with AC) | Example ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
Input API Key SID string / Required apiKey | Notes An API Key SID (starts with SK) | Example SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
Input API Key Secret string / Required apiSecret | Notes The API secret that was generated when an API key was created | Example |
#
Twilio Auth Token ConnectionWhen 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.
Input | Notes | Example |
---|---|---|
Input Auth Token string / Required password | Notes Can be found on https://console.twilio.com/ | Example |
Input Account SID string / Required username | Notes Your account SID (starts with AC) | Example ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
#
Triggers#
WebhookTrigger 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#
Get SMSGet an SMS message | key: getSMS
Input | Notes |
---|---|
Input Message SID string / Required sid | Notes |
Input Connection connection / Required twilioConnection | Notes |
#
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" }}
#
List SMS messagesLists SMS messages | key: listMessages
Input | Notes |
---|---|
Input Connection connection / Required twilioConnection | Notes |
#
Raw RequestSend Raw Request To Twilio | key: rawRequest
Input | Default | Notes | Example |
---|---|---|---|
Input Data string data | Default | Notes The HTTP body payload to send to the URL. | Example {"exampleKey": "Example Data"} |
Input Debug Request boolean debugRequest | Default false | Notes Enabling this flag will log out the current request. | Example |
Input File Data string Key Value List fileData | Default | Notes File Data to be sent as a multipart form upload. | Example [{key: "example.txt", value: "My File Contents"}] |
Input File Data File Names string Key Value List fileDataFileNames | Default | Notes File names to apply to the file data inputs. Keys must match the file data keys above. | Example |
Input Form Data string Key Value List formData | Default | Notes The Form Data to be sent as a multipart form upload. | Example [{"key": "Example Key", "value": new Buffer("Hello World")}] |
Input Header string Key Value List headers | Default | Notes A list of headers to send with the request. | Example User-Agent: curl/7.64.1 |
Input Max Retry Count string maxRetries | Default 0 | Notes The maximum number of retries to attempt. | Example |
Input Method string / Required method | Default | Notes The HTTP method to use. | Example |
Input Query Parameter string Key Value List queryParams | Default | Notes A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2. | Example |
Input Response Type string / Required responseType | Default json | Notes The type of data you expect in the response. You can request json, text, or binary data. | Example |
Input Retry On All Errors boolean retryAllErrors | Default false | Notes If true, retries on all erroneous responses regardless of type. | Example |
Input Retry Delay (ms) string retryDelayMS | Default 0 | Notes The delay in milliseconds between retries. | Example |
Input Timeout string timeout | Default | Notes The maximum time that a client will await a response to its request | Example 2000 |
Input Connection connection / Required twilioConnection | Default | Notes | Example |
Input URL string / Required url | Default | Notes This is the URL to call. | Example /Accounts/$TWILIO_ACCOUNT_SID/Messages.json |
Input Use Exponential Backoff boolean useExponentialBackoff | Default false | Notes Specifies whether to use a pre-defined exponential backoff strategy for retries. | Example |
#
Send SMSSend an SMS message | key: sendSMS
Input | Notes | Example |
---|---|---|
Input From string / Required from | Notes The SMS sender's phone number. | Example 5555551234 |
Input Message string / Required message | Notes The message body of the SMS message. | Example Hello from Prismatic! |
Input To string / Required to | Notes The SMS recipient's phone number. | Example 5551234567 |
Input Connection connection / Required twilioConnection | 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" }}