Skip to main content

Trigger launch (API call)

Top priority instantly launched trigger campaigns.

tip

To launch a trigger at the precise time of a new profile import you can use Import + trigger request.

Version 1.1

Description

It has several advantages compared with API V. 1.0:

  • Requests can change campaign content for each launch.
  • Sends messages to an audience instead of single profiles.
  • Advanced audience matching — profile ID, custom fields, external database queries.
  • API token in message body for advanced security.
  • Static request URL /api/v1.1/campaigns/triggers/start as compared to a dynamically generated link bound to a certain profile database.

Request URL

Method: POST

https://example.com/api/v1.1/campaigns/triggers/start/

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
idstring5511YesTrigger campaign ID
contentJSON object{ "field": "value" }NoAdditional content for API content filter node
and template apicontent variables
attachJSON array[]NoAttach file(s) to campaign messages
custom_dataJSON object{ "x": "y"}NoAdd some data to be used in Action hooks.
Profile matching mode
matchingstring"email"
"phone"
"profile_id"
"custom"
No, if matched by emailProfile matching mode
By default - email
emailstring"john@example.com""matching":"email"Email address
phonestring"+79000000000""matching":"phone"Phone number
profile_idstring"abcdefghijklmnqrstuvwxyz""matching":"profile_id"Profile ID
field_namestring"CRM_ID""matching":"custom"Custom profile data field name
field_valueint/string"123420""matching":"custom"

Custom profile data field value.

tip

Searching by combination of tags is available for tag type profile fields. Values are recorded as a string: "tag-1, tag-2".

resource_idint24NoResource ID for email and
phone matching
custom_requestJSON objectWhen no matching
specified
Custom MongoDB database query
subscription_filterJSON objectPush example:
"subscription_filter": {
   "subscription_id": "CAREFULWITHTHATAXE",
   "provider": "Chrome",
   "not_strict": true
}
Email example:
"subscription_filter": {
   "email": "example@example.com",
   "not_strict": true
}
SMS example:
"subscription_filter": {
   "phone": "+79106135133",
   "not_strict": false
}
NoSelects a profile's subscription to send message

Not used if custom_request is set.

not_strict determines what to do when a certain subscription is not found. If "true" — another fitting subscription will be used instead.

Request example

This example triggers a campaign for a single subscriber:

{
"token": "e00c3da0a53e4e54a795da58701f4d70",
"id": 5511,
"profile_id": "5a74876369d42613b31947b8"
}

Send messages to subscribers with Custom_IDs from a list ["IpHicQquekzYkufl", "xzFKLXeaJkCYHuMb", "SRNOwHVZiWFItJhr"].

{
"token": "e00c3da0a53e4e54a795da58701f4d70",
"id": 5511,
"matching": "custom",
"field_name": "Custom_ID",
"field_value": ["IpHicQquekzYkufl", "xzFKLXeaJkCYHuMb", "SRNOwHVZiWFItJhr"]
}

Insert text "New videos on your favorite channels" to replace {apicontent.email_title} message content variable..

Attach files "日本.txt" and US.txt".

{
"attach": [
{
"data": "data:text/csv;base64,5LuK5pel44GvCg==",
"name": "日本.txt"
},
{
"data": "data:text/csv;base64,SEVMTE8K",
"name": "US.txt"
}
],
"content": {
"data_lines": [
"Channel A",
"Channel B"
],
"email_title": "New videos on your favorite channels"
},
"id": 5511,
"token": "abcdefghijklmnqrstuvwxyz"
}

Response example

{
"error": 0,
"error_text": "Successful operation"
}

Version 1.0

Description

Methods: GET, POST

In this version, each API trigger has a unique link that is displayed after it is created.

http://<your.tracking.domain>/trg/<base16_value_d1d93d9cca76a7c1742a2f23fbacd>/<email|md5|xxh>

The link will change if you change the trigger database.

Using link 1.0 allows you to send a trigger to only one profile per request.

"email" is a deprecated parameter.

GET request

Sends a message with no optional parameters.

Matches profiles by email, md5 hash or XX hash. XX hash profile matching example:

http://trk.example.org/trg/465ea6fedf0a75fa9ee0b5fb8f9d5fe89af34054909af8bb/dd78094ad0e36ca3

POST JSON request

The same link is used as in the GET request.

http://trk.example.org/trg/465ea6fedf0a75fa9ee0b5fb8f9d5fe89af34054909af8bb/dd78094ad0e36ca3

With POST method you have an option to attach JSON data to message body.

You can override database field values for a campaign message or even update database fields.

{
"fields": [
{
"name": "FirstName",
"value": "Jason",
"option": 0
},
{
"name": "Order",
"value": "123abc456-78",
"option": 1
}
]
}
  • "name" — profile database field name. If no field matches this name — it won't be used.
  • "value" — profile database field value. Must match field data type.
  • "option" — ( 0 | 1 | 2 ) determines data usage options.
  • "option": 0 — if a database field is not empty — request data will be ignored.
  • "option": 1 — request field value will be used in the message, but will not rewrite database value.
  • "option": 2 — request field value will be used in the message and will rewrite database value.