Skip to main content

Bulk trigger launch

Description

Launches a trigger campaign for multiple profiles.

This request is a batch version of the Trigger Launch (API call) request.

note

The request body size is limited by default to 10 Mb, exception for files — 100 Mb.

URL request

Method: POST

http://example.com/api/v1.1/campaigns/triggers/start_batch

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
formatstring"json"NoResponse data format.
By default – json
trigger_idint1YesTrigger campaign ID
attachJSON array of File object[]NoFile object
contentJSON object

{    "H1": "Weather alert",    "H2": "Welcome" }

NoData you can use in a message template using {apicontent.fieldname} variable
custom_dataJSON object
{
"field": "value"
}
NoAdd some data to be used in Action hooks. The parameter can be passed either at the root of the request or separately in each data object.
dataarray

[    {"email": "profile1@example.com"},    {"email": "profile2@example.com"} ]

YesA field in the database and its value, which will be used to search for the desired profile.
Profile matching mode
matchingstring

"email"
"email_profile"
"email_sub"
"phone"
"phone_sub"
"profile_id"
"push_sub"
"custom"
"custom_sub"
"email_phone"
"email_phone_sub"

No, if matched by email from profile or subscriptionsProfile matching mode
By default - email
Learn more.

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError text
resultarrayProfile IDs to which the campaign was sent

Request example (matching by email)

{
"token": "abcdefghijklmnqrstuvwxyz",
"trigger_id": 8,
"format": "json",
"matching": "email",
"data": [
{"email": "profile1@example.com"},
{"email": "profile2@example.com"}
]
}

Request example (matching by custom field)

{
"token": "abcdefghijklmnqrstuvwxyz",
"trigger_id": 455,
"format": "json",
"skip_triggers": false,
"matching": "custom",
"field_name": "New_field_1",
"data": [
{
"field_value": "001"
},
{
"field_value": "002"
}
]
}

Response example

{
"error": 0,
"error_text": "Successful operation",
"result": [
{
"error": 409,
"error_text": "Unclear Matching"
},
{
"profile_id": "6042600a363b2746cd972a83"
}
]
}

Response example when a request constraint is triggered

{
"error":400,
"error_debug":"http: request body too large",
"error_text":"Invalid request"
}