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.

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.

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.

Triggers

Webhook

Receive and validate webhook requests from Twilio for webhooks you configure. | 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": null,
"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 SMS

Get an SMS message | key: getSMS

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 messages

Lists SMS messages | key: listMessages


Raw Request

Send raw HTTP request to Twilio | key: rawRequest


Send SMS

Send an SMS message | key: sendSMS

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"
}
}