The Add Phone to Sender Code command allows you to subscribe an existing SMS contact to an SMS Sender Code. The command is used for Contacts who do not also exist as email contacts and have no email address.
POST /sms/addPhoneToSenderCode
https://[siteurl]/rest/sms/addPhoneToSenderCode/[phone]/[senderCode]?querystring
The following queries are supported:
groupName=[string]
Request Body Parameters
The Add Phone to Sender Code command requires the URI call with the Contact Phone and SMS Sender Code. Optional Filter includes the Group Name parameter.
The query string 'groupName' is case sensitive and must be defined as in the example above. A Group Name must be defined in order to save. If the query string is incorrect or missing, it is ignored and the command creates a message with no Group.
Request Body Example
Using Add Phone to Sender Code with all arguments, line breaks in JSON for readability:
curl --request POST \
--url 'https://mail.mydomain.com/rest/sms/addPhoneToSenderCode/2065559696/2065551212?groupName=weekly' \
--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
{
"id": 180
"realmId": 10
"smsSubscriberId": 373
"smsSenderId": 3
"smsGroupId": 42
"authenticated": false
"createdDate": "Mar 16, 2018 9:10:50 AM"
"updatedDate": "Mar 16, 2018 9:10:50 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 already exists for the Contact, the error would appear as:
{
"error": "An SMS Subscription already exists"
"status": "Internal Server Error"
"statusCode": 500
}
Feature added in v12.16.0