Follow

Send Message with Subscriber Model using IDs

The Send Message with Subscriber Model using IDs command allows you to send a single transactional style message to a Subscriber and include Subscriber Custom Data. It identifies the List and Templates using the IDs instead of Names.  This is recommended when users are allowed to change the name of Lists or Templates, which may break commands where the List and Template Names are required. 

Messages are individually created and sent but can be tracked together as a sticky campaign to collect data as a single campaign.  To group your data into a single campaign, either use the Campaign Name argument or use a List with Sticky Campaigns enabled. 

This command does not support the same features as the HTTP API, FTP API, or WebServices API Send commands, including the ability to define Google Analytics strings and Account Profile.

POST /lists

https://[siteurl]/rest/msg/sendWithIdsAndModel/[listId]/[templateId]?querystring

The following queries are supported:

format=[1,2,99], where 1=plain text, 2=html, and 99=MIME

campaignName=[string],
To track one-off message events, such as opens and click-throughs, define a campaign name. The Campaign Name can be no longer than 100 characters. A single list can have multiple campaigns by defining a different Campaign Name in a command.

respectOptout=[true,false],
If a subscriber has opted out, messages sent via the Send command will not be delivered. To override this restriction for transactional messages, such as order confirmations, set this argument to 'false'. DO NOT override opt outs for anything other than transactional messages, as this could be construed as spam.

Request Body Parameters

The Send Message with Subscriber Model using IDs command requires the URI call with the List ID and Template ID. Other Filters include Format, Campaign Name, and Opt Out parameters. 

The query strings are case sensitive and must be defined as in the example.  If the query string is incorrect or missing, it is ignored and the command creates a Plain Text message without duplication, sending to the first subscriber found to match the posted JSON. 

The command also requires the Subscriber identification in the Posted JSON, either Email and First Name, or Subscriber ID, or Customer Key in an enabled realm:

  • Subscriber ID: "subscriberId": "[subscriberId]"
  • Email Address: "email": "[email]"
  • First Name: "firstName": "[firstName]"
  • Customer Key: "customerKey": "[customerKey]"

Request Body Example

Using Send Message with Subscriber Model using IDs with all arguments using Subscriber Email and First Name, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/msg/sendWithIdsAndModel/5/42?format=99&campaignName=myContentSend&respectOptout=true' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "email": "jon.doe@mydomain.com", "firstName": "Jon", "customData": { "text": "text", "unicode": "unicode text", "large": "big", "number": 12, "float": 12.12, "date": "2016-07-04" } }' \
--include

Using Send Message with Subscriber Model using IDs with all arguments using Subscriber ID, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/msg/sendWithIdsAndModel/5/42?format=99&campaignName=myContentSend&respectOptout=true' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "subscriberId": 716094, "customData": { "text": "text", "unicode": "unicode text", "large": "big", "number": 12, "float": 12.12, "date": "2016-07-04" } }' \
--include

Using Send Message with Subscriber Model using IDs with all arguments using Subscriber Customer Key, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/msg/sendWithIdsAndModel/5/42?format=99&campaignName=myContentSend&respectOptout=true' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "customerKey": "ck3212", "customData": { "text": "text", "unicode": "unicode text", "large": "big", "number": 12, "float": 12.12, "date": "2016-07-04" } }' \
--include

Response Body

The response returns a Success or Failure Error.  Based on the first example above, the response returns a 0 for Success:

HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Content-Length: 1
Date: Fri, 17 Mar 2018 12:54:44 GMT
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 List, Template or Subscriber are not found.

For example, if a Subscription does not exist for the Subscriber, the error would appear as:

{
"error": "Subscriber Not Found"
"status": "Not Found"
"statusCode": 404
}

Feature added in v13.00.0

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

Comments

Powered by Zendesk