Skip to main content

Task for bulk trigger launch

Description

Launches a trigger campaign for multiple profiles.

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

Returns a response with the task id, without waiting for completion.

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_task

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
formatstring"json"NoResponse data format
By default – "json"
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
{
"_fname": "John",
"_lname": "Doe"
}
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 subscriptions
Profile matching mode.

By default - email

Learn more.
emailstring"john@example.com""matching":"email" - both profile data and subscriptions
"matching":"email_profile" - profile data only

"matching":"email_sub" - subscription data only
Email address
phonestring"+79000000000""matching":"phone" - by phone number from profile or subscriptions

"matching":"phone_sub" - by phone number from subscriptions
Phone number
profile_idstring"abcdefghijklmnqrstuvwxyz""matching":"profile_id"Profile ID
field_namestring"matching":"custom"Name of the custom profile data field
field_value"matching":"custom"Value of the custom profile data field
custom_requestJSON objectIf there is no "matching" parameterMongoDB request on profile fields

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError text
task_idstringTask ID

Request example (matching by email)

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

Request example (matching by custom field)

{
"token": "abcdefghijklmnqrstuvwxyz",
"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",
"task_id": "30421978-7f6d-4f39-913f-fb6cad8e2477"
}

Response example when a request constraint is triggered

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