Profile import + trigger campaign launch
Description
A new customer profile import followed by a trigger campaign launch.
URL
Method: POST
https://example.com/api/v1.1/campaigns/triggers/import_and_start
Request parameters
Parameters | Type | Example | Required | Description |
---|---|---|---|---|
Profile import | ||||
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
data | JSON object |
| Yes | Profile fields data |
skip_triggers | bool | true | No | Skip trigger events. By default – false |
skip_invalid_subscriptions | bool | true | No | Skip invalid subscriptions By default – false |
detect_geo | bool | true | No | Detect location by _regip or _ip from data object |
Profile matching mode | ||||
matching | string | "email" | No, if matched by email from profile or subscriptions | Profile matching mode By default - email |
string | "john@example.com" | "matching":"email" - both profile data and subscriptions "matching":"email_profile" - profile data only | Email address | |
phone | string | "+79000000000" | "matching":"phone" | Phone number |
profile_id | string | "abcdefghijklmnqrstuvwxyz" | "matching":"profile_id" | Profile ID |
field_name | string | "CRM_ID" | "matching":"custom" | Custom profile data field name |
field_value | int/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_id | int | 24 | No | Resource ID for email and phone matching |
Trigger launch | ||||
trigger_id | int | 13 | Yes | Trigger campaign ID |
timeout | JSON object |
| No | Trigger start timeout. Specify the days, hours, and minutes to set the timeout period. |
custom_data | JSON object |
| No | Add some data to be used in Action hooks. |
content | JSON object |
| No | Data you can use in a message template using {apicontent.fieldname} variable |
attach | JSON objects array |
| No | A file you can attach to an Email message |
Request example
{
"token": "care13fulwi3thttha2taxe43euge2ne",
"matching": "email",
"email": "example@example.com",
"detect_geo": true,
"data": {
"_fname": "Olly",
"_lname": "Lambert",
"email": "example@example.com",
"phones": [
"+790000000000"
],
"_bdate": "1990-02-22T21:00:00Z",
"custom_field": "custom_value",
"subscriptions": [
{
"channel": "email",
"email": "example@example.com",
"resource_id": 1
},
{
"channel": "phone",
"phone": "+790000000000",
"resource_id": 1
}
]
},
"trigger_id": 13,
"timeout": {
"days": 0,
"hours": 0,
"minutes": 5
},
"custom_data": {
"sending_time": "12:31:12"
},
"content": {
"page": "registration_form"
},
"attach": [
{
"data": "data:text/csv;base64,5LuK5pel44GvCg==",
"name": "Attach.txt"
}
]
}
Response example
{
"error": 0,
"error_text": "",
"profile_id": "54759eb3c090d83494e2d804"
}
caution
Subscription to the Resource that is used by the trigger campaign has to be sent within profile data object. If not — the following mistake will be sent back:
{
"error": 400,
"error_text": "No active subscriptions passed for trigger resource"
}
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error description |
profile_id | string | Imported profile ID |