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
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
format | string | "json" | No | Response data format By default – "json" |
id | int | 1 | Yes | Trigger campaign ID |
attach | JSON array of File object | [] | No | File object |
content | JSON object |
| No | Data you can use in a message template using {apicontent.fieldname} variable |
custom_data | JSON object |
| No | Data used for integration Action hooks |
data | array |
| Yes | A field in the database and its value, which will be used to search for the desired profile. |
Profile matching mode | ||||
matching | string | "email" | No, if matched by email from profile or subscriptions | Profile matching mode. By default - email Learn more. |
string | "john@example.com" | "matching":"email" - both profile data and subscriptions "matching":"email_profile" - profile data only "matching":"email_sub" - subscription data only | Email address | |
phone | string | "+79000000000" | "matching":"phone" - by phone number from profile or subscriptions "matching":"phone_sub" - by phone number from subscriptions | Phone number |
profile_id | string | "abcdefghijklmnqrstuvwxyz" | "matching":"profile_id" | Profile ID |
field_name | string | "matching":"custom" | Name of the custom profile data field | |
field_value | "matching":"custom" | Value of the custom profile data field | ||
custom_request | JSON object |
| When no matching specified | Custom MongoDB database query |
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
task_id | string | Task ID |
Request example (matching by email)
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 96,
"format": "json",
"matching": "email",
"data": [
{
"email": "example1@example.com"
},
{
"email": "example2@example.com"
}
]
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>96</id>
<format>xml</format>
<matching>email</matching>
<data>
<email>example1@example.com</email>
</data>
<data>
<email>example2@altcraft.com</email>
</data>
</xml>
Request example (matching by custom field)
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 96,
"format": "json",
"skip_triggers": false,
"matching": "custom",
"field_name": "Custom_ID",
"data": [
{
"field_value": "001"
},
{
"field_value": "002"
}
]
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>96</id>
<format>xml</format>
<skip_triggers>false</skip_triggers>
<matching>custom</matching>
<field_name>Custom_ID</field_name>
<data>
<field_value>001</field_value>
</data>
<data>
<field_value>002</field_value>
</data>
</xml>
Response example
- JSON
- XML
{
"error": 0,
"error_text": "Successful operation",
"task_id": "30421978-7f6d-4f39-913f-fb6cad8e2477"
}
<xml>
<error>0</error>
<error_text>Successful operation</error_text>
<task_id>392b7e46-e4d9-4a07-959a-1e541138b684</task_id>
</xml>
Response example when a request constraint is triggered
- JSON
- XML
{
"error": 400,
"error_debug": "http: request body too large",
"error_text": "Invalid request"
}
<xml>
<error>400</error>
<error_debug>http: request body too large</error_debug>
<error_text>"Invalid request"</error_text>
</xml>