Follow

Create SMS Message

The Create SMS Message command allows you to define message content to send via SMS.   

POST /sms/createMessage

https://[siteurl]/rest/sms/createMessage/[messageName]/[messageText]?querystring

The following queries are supported:

label=[string], comma separated list of strings for predefined labels  

Request Body Parameters

The Create SMS Message command requires the URI call with the Message Name and Message Text. Optional Filter includes the Label parameter. 

The query string 'label' is case sensitive and must be defined as in the example above.  The label(s) must be defined for the Account and associated to the SMS product in order to save.  If the query string is incorrect or missing, it is ignored and the command creates a message with no label.

Request Body Example

Using Create SMS Message with all arguments, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/sms/createMessage/My+SMS+Message/Welcome+to+SMS?label=welcome,sms' \
--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 12:54:44 GMT
{
"id": 443 "realmId": 10 "totalParts": 1 "name": "My SMS Message" "messageText": "Welcome to SMS"
"label": "welcome,sms" "createdDate": "Jan 31, 2018 8:41:55 AM" "updatedDate": "Jan 31, 2018 8:41:55 AM"
}

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 a Subscription does not exist for the Subscriber, the error would appear as:

{
"error": "Message could not be saved. Please enter a unique name 1 or more characters in length"
"status": "Internal Server Error"
"statusCode": 500
}

Feature added in v12.16.0

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk