twilio.sms.send
The twilio.sms.send command is used to send an SMS message to a phone number.
TR50 Request
{
"cmd" : {
"command" : "twilio.sms.send",
"params" : {
"to" : ["PHONENUMBER"],
"body" : "This is an SMS message sent by the API."
}
}
}
Request Parameters
The phone number format (for use in the From and To phone number fields) supported by Twilio is E.164. Please refer to https://www.twilio.com/docs/glossary/what-e164 for more information.
Name | Type | Required | Description |
---|---|---|---|
to | String | Yes | The recipient's phone number(s). Can be a string array of phone numbers, or a string containing the key of a notification group. |
from | String | The sender's phone number. | |
body | String | Yes | The body of the SMS message. |
TR50 Response
If the command is sent successfully a success message is returned. Success is returned even for a partial success. Otherwise, an error and error message will be returned.
{
"cmd": {
"success": true
}
}
Response Parameters
Name | Type | Description |
---|---|---|
failures | Array | Any failures that occurred, if there was a partial success. |
PHP API
bool TR50httpWorker::twilioSmsSend($to, $body[, $from]);