Follow

Add SMS Subscriber To Sender Code

The Add SMS Subscriber to Sender Code command allows you to subscribe an existing SMS subscriber to an SMS Sender Code. 

POST /sms/addSubscriberToSenderCode

https://[siteurl]/rest/sms/addSubscriberToSenderCode/[email]/[phone]/[senderCode]?querystring

The following queries are supported:

groupName=[string] 
first=[string] 
customerKey=[string]

Request Body Parameters

The Add SMS Subscriber to Sender Code command requires the URI call with the Subscriber Email, Phone and SMS Sender Code. Optional Filter includes the Group Name and First name parameters. Customer Key is required in Account with Customer Key enabled.

The query strings 'groupName', 'first', and 'customerKey' are case sensitive and must be defined as in the example above.  The Group Name must be defined for the Account 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 Add SMS Subscriber to Sender Code with all arguments, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/sms/addPhoneToSenderCode/jon.doe@mydomain.com/2065559696?groupName=weekly&first=Jon&customerKey=jDoe3214' \
--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": 427 "realmId": 0 "subscriberId": 716094 "phone": "2065559696" "country": "US" "verified": true "createdDate": "Mar 16, 2018 9:10:50 AM" "updatedDate": "Mar 16, 2018 9:10:50 AM" "source": "API"
}

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 Subscriber, the error would appear as:

{
"error": "Unable to create subscriber record. A subscriber with this phone number already exists."
"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