Advanced Campaign Features

How to send a campaign with more advanced settings

POST https://api.cm.com/messages/v1/accounts/{accountId}/messages

Example post body:

{
    "body": "Hello {{1}}, this is an advanced test campaign. This can contain a link => [[url:http://www.cm.com]] or CM Pages [[page:b99f6d4f-243a-11e7-9742-005056b0187a]] or OptOut instructions [[optout]]",
    "ignoreUnsubscribes" : false,
    "scheduledAtUtc": "2018-08-15T13:09:43.715Z",
    "recipients": [
                    { "group": "b99f6d4f-243a-11e7-9742-005056b0187a" },
                    { "contact": "0b7bf29a-2439-11e7-9742-005056b0187a" },
                    { "msisdn": "+31627142592", "data": { "1": "John", "3": "Doe", "5":"[email protected]","6": "CM.com" } }
                  ],
    "senders": ["TEST"],
    "countrySpecificSenders": {
        "NL": "CM.com",
        "BE": "0032496448785",
        "UK": "88882"
    },
    "spread": {
        "timeFrames": [
            {
                "days": [
                    "Mon",
                    "Tue",
                    "Wed",
                    "Thu",
                    "Fri",
                    "Sat",
                    "Sun"
                ],
                "startTime": "09:00",
                "endTime": "12:00"
            },
            {
                "days": [
                    "Mon",
                    "Tue",
                    "Wed",
                    "Thu",
                    "Fri",
                    "Sat",
                    "Sun"
                ],
                "startTime": "13:00",
                "endTime": "17:30"
            }
        ],
        "until" : "2019-03-14T15:00:26.9932482Z"
    },
    "options": {
        "urlShortenerDomainId": "0b7bf29a-2439-11e7-9742-005056b0187b"
    }
}

scheduledAtUtc : defines when the campaign will be sent, timezone is UTC, please make sure you adjust your time before supplying values.

Data tags like {{1}} are placeholders for custom data retrieved from Addressbook or msisdn data.

Links enclosed in double square brackets like [[url:http://www.cm.com]] will be converted into shortlinks like https://cm.to/sH012tL which are 22 characters long.

CM Pages tags are enclosed in double square brackets, starts with page: and includes page the related page guid. They are also translated into shortlinks (22 chars).

Optout tag inserts optout instructions per recipient, if recipient's country has a predefined shortcode for STOP messages it will translate into STOP shortcode otherwise it will translated into an optout link like https://NO-S.MS/OptOut

ignoreUnsubscribes : By default Campaigns API filters recipients using the Unsubscribes list in Addressbook. If this setting is set to true, unsubscribes will not be filtered.

Msisdn with data : It is possible to add a data dictionary to msisdn recipients so data tags in the body can be rendered also for msisdn recipients.

Senders : Specifies the default sender to use unless a specific sender is defined for recipients country in countrySpecificSenders setting

spread : Spread until setting makes sure that messages are delivered in batches over a certain amount of time between scheduled time and spread until setting. Value must be in UTC

timeFrames : Defines the allowed days and time periods where the messages are allowed to be sent.

options : Holds an object with extra options.

  • urlShortenerDomainId : Currently only holds a Guid to a custom domain, which refers to a domain created in the branded links app. Short URLs will then be created with this domain instead of with the cm.to domain.

Time frame startTime and endTime values must be in UTC


Below are the list of default data tags, if you have other custom fields defined in addressbook/msisdn data, you have to use relevant custom field ids.

NameFieldIdTag
FirstName11
Insertion22
LastName33
PhoneNumber44
EmailAddress55
Company66