In the example below you can see how a Twillio SMS channel can be built using a webhook template. This can be used to send SMS messages via Twillio. The url comes from the twillio API docs and includes your Twillio account id starred below.
URL: https://api.twilio.com/2010-04-01/Accounts/***************/Messages.json
The API call is being made to this Messages endpoint used to send SMS messages and it takes POST params. Params include:
- Body: The text of the message to be sent
- From: The from header used in the SMS message usually your brand name e.g. "xtremepush"
- To: the mobile number of the user this is being pulled in from your users profile via the personalisation syntax {{mobile_number}}
NOTE: to make it an MMS message add the MediaUrl param
- MediaUrl: A link to the image you want to use in your MMS message
Finally this API requires a number of headers:
- Authorization: used to authenticate the API call the example uses a base64 encoded credential starred out below. This is credential is created by base64 encoding the following credentials concatenated with a colon in between: your_account_id:your_auth_token
- Host: the host used for the API call
- Content-type: in this example the type is “application/x-www-form-urlencoded”
Template
Once you have your webhook working we recommend you save it as a template. This will allow you to quickly select it on the webhook channel page in campaign creation:
So you can save your Twillio template with all settings configured except for the message text. When you want to send SMS via Twillio use you webhook template and fill out the message text.
Comments
0 comments
Article is closed for comments.