Overview
You can use the contacts API collection to retrieve, add, and update the SMS object using the appropriate JSON body.
Example SMS object
SMS object retrieved using the GET method:
{ "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "keyword": "join", "subscribedAt": "2020-04-16T20:52:21+0000", "unsubscribedAt": "", "subscribeStatus": "subscribed" } } } } }
Parameter details
The SMS channel key may differ depending on your account configuration.
Parameter | Description |
---|---|
channels.sms.address | A unique SMS channel address. |
channels.sms.programs.programName | Your SMS marketing program name configured in SMS Settings. |
channels.sms.programs.programName.keyword | Keyword associated with the SMS marketing program. Contacts are subscribed to the SMS program using one of the program opt-in keywords configured in SMS Settings. |
channels.sms.programs.programName.unsubscribedAt | The most recent date contact unsubscribed from receiving SMS marketing program messages. |
channels.sms.programs.programName.subscribedAt | The most recent date contact subscribed to receive SMS marketing program messages. |
channels.sms.programs.programName.subscribeStatus | Contact's current SMS marketing program subscribe status. |
SMS subscribe status
SMS contact subscribe status can be none
, pendingDOI
, subscribed
, or unsubscribed
.
Subscribe status | Description |
---|---|
none | Typically assigned to contacts who have an SMS channel address but have not been subscribed to an SMS marketing program in the past. These contacts cannot receive SMS marketing messages until subscribed. |
pendingDOI |
Indicates the opt-in message has been sent to the contact following a request to subscribe their SMS channel address to the SMS marketing program. This status will persist until contact completes the double opt-in signup process (DOI) by replying to the opt-in message with one of the confirmation keywords. These contacts cannot receive SMS marketing messages until subscribed. |
subscribed | The contact has completed the DOI signup process and can now receive SMS marketing messages. Only contacts who have given prior written consent (typically through the DOI signup process) can be subscribed and receive SMS marketing messages. |
unsubscribed | Set when the contact opts-out of receiving SMS messages. If a request is made to resubscribe the SMS channel address, the contact will be required to complete the DOI signup process once again. |
Create a new SMS record
You can create a new SMS record using the POST method and the appropriate JSON body.
Request to create a new SMS record (minimum requirements)
{ "channels": { "sms": { "address": "12225555151" } } }
The resulting record is given the subscribe status of none
at the SMS channel level. The DOI signup process will not be triggered.
Request to create and subscribe an SMS contact via the API
{ "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "keyword": "join", "subscribeStatus": "subscribed" } } } } }
When subscribing a contact, the SMS programName
, keyword
and subscribeStatus
values are required. This POST will trigger the DOI signup process and the opt-in message will be sent to the contact's SMS channel address. The resulting contact's subscribe status is set to pendingDOI
at the SMS program level. When the contact confirms their intent (completes the DOI signup process), the subscription status will change to subscribed
.
Request to create and subscribe an SMS contact via JavaScript Listener v2
{ crdl("contact", {"sms": "12225555151"}, { "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "keyword": "join", "subscribeStatus": "subscribed" } } } } }) }
Attempts to subscribe a contact without the SMS program name and keyword values will result in an error.
Update an existing SMS record
You can update existing SMS records using the PUT method and the appropriate JSON body.
Request to unsubscribe an existing SMS contact
{ "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "subscribeStatus": "unsubscribed" } } } } }
The SMS program keyword
is not required in order to unsubscribe the contact. This PUT will immediately set the contact's SMS program subscription status to unsubscribed
and the contact will be sent the default stop message.
Resubscribe an existing SMS contact
-
The most recent
subscribedAt
andunsubscribedAt
timestamps remain in theunsubscribed
contact record. This is an example SMS record after being unsubscribed from the SMS marketing program.{ "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "keyword": "join", "subscribedAt": "2020-07-23T00:36:16+0000", "unsubscribedAt": "2020-07-24T00:38:51+0000", "subscribeStatus": "unsubscribed" } } } } }
-
The same SMS channel address can be resubscribed using the PUT method and the appropriate JSON body.
{ "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "keyword": "join", "subscribeStatus": "subscribed" } } } } }
-
The
subscribeStatus
will be set topendingDOI
and updated tosubscribed
after contact completes the DOI signup process. ThesubscribedAt
timestamp will also be updated to reflect the most recent subscription date and time, and the previousunsubscribedAt
timestamp will not be retained.{ "channels": { "sms": { "address": "12225555151", "programs": { "cordialthreads": { "keyword": "join", "subscribedAt": "2020-07-23T00:36:16+0000", "subscribeStatus": "pendingDOI" } } } } }
Comments
0 comments
Please sign in to leave a comment.