Skip to main content

Twilio

Profile Requirements

To deliver a message to a recipient over Twilio, Courier must be provided the recipient's SMS-compatible phone number. This value should be included in the recipient profile as phone_number.

JSON
// Recipient Profile
{
"phone_number": "+12345678901"
}

Overrides

Overrides can be used to change the request body that Courier uses to send an SMS message. Overrides are useful when a field is not yet supported by Courier or you would like to override the value that Courier generates. You can override any of the fields supported by Twilio's Messages.json endpoint (see all send request body fields here). Below is an example of overriding the to phone number and the account SID + auth token for the configuration:

JSON
{
"event": "<COURIER_NOTIFICATION_ID>",
"recipient": "katherine_pryde",
"profile": {
"phone_number": "+12345678901"
},
"data": {
"name": "Katherine Pryde"
},
"override": {
"twilio": {
"body": {
"to": "+109876543210"
}
},
"config": {
"accountSid": "<your Account SID>",
"authToken": "<your Auth Token>",
"messagingServiceSid": "<your Messaging Service SID>"
}
}
}
Was this helpful?