The Send SMS Message to Phone command allows you to send any SMS message text to a specified Phone number. An SMS Subscription or Contact is not required, and the command does not validate if the Phone is subscribed. The command provides the option to send to a Phone number directly without predefined message content. The command does honor all SMS opt outs with no option to override the opt out.
POST /sms/sendMessageToPhone
https://[siteurl]/rest/sms/sendMessageToPhone/[messageText]/[phone]/[senderCode]
Request Body Parameters
The Send SMS Message to Phone command requires the URI call with the one off Message Text, Phone, and Sender Code.
Request Body Example
Using Send SMS Message to Phone with all arguments, line breaks in JSON for readability:
curl --request POST \
--url 'https://mail.mydomain.com/rest/sms/sendMessageToPhone/One+time+message+for+you./2065559696/2065551212' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--include
Response Body
The response returns JSON or an HTTP status code. Based on the first example above, the response returns:
HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Content-Length: 456
Date: Fri, 16 Mar 2018 09:10:50 GMT
{
[
{
"success": true,
"createDate": "Jan 27, 2020 1:13:54 PM",
"updatedDate": "Jan 27, 2020 1:13:54 PM",
"partSent": 1,
"realmId": 1,
"smsSenderId": 5,
"totalParts": 1,
"messageId": "13000000AB005CC6",
"phone": "15558999520",
"status": "0"
}
]
}
Error Response
Error Response Codes include both Client Errors (4xx) and Server Errors (5xx). Descriptions of each can be found in Response Codes. An error will occur if Message Name or Text is blank, or a Message with the same Name already exists.
For example, if the Sender Code does not exist, the error would appear as:
{
"error": "Error getting sender with senderCode 1 realmID: 10"
"status": "Internal Server Error"
"statusCode": 500
}
Feature added in v12.16.0