Create trigger campaign
Description
Creates a new trigger campaign.
Request URL
Method: POST
https://example.com/api/v1.1/campaigns/triggers/add/
Request parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
| format | string | "csv" | No | Response data format. By default – json |
| name | string | "New Awesome Campaign" | Yes | New campaign name |
| is_active | bool | true | No | Activates campaign instantly |
| content | JSON array | [
{
"from_email": "",
"from_name": "",
"message_id": 12,
"replyto_email": "",
"replyto_name": "",
"subject": "Weather alert"
}
] | Yes | Message template object |
| subid | string | "Adv_1" | No | Campaign SubID |
| trigger_type | string | "api_call" | Yes | Trigger type |
| skip_minutes | int | 0 | No | Wait for X minutes before sending |
| resource_id | int | 24 | No | resource ID |
| send_channel | string | "email" "sms" "push" | Yes | Sending channel |
| content_type | string | "email" | No | Deprecated. If you pass this parameter, the campaign will use the email channel for sending, no matter what value you specify. It is recommended to use send_channel. |
| send_email_content | bool | true | No | Deprecated. If you pass this parameter, the campaign will use the email channel for sending, no matter what value you specify. It is recommended to use send_channel. |
| send_sms_content | bool | true | No | Deprecated. If you pass this parameter, the campaign will use the email channel for sending, no matter what value you specify. It is recommended to use send_channel. |
| send_push_content | bool | true | No | Deprecated. If you pass this parameter, the campaign will use the email channel for sending, no matter what value you specify. It is recommended to use send_channel. |
| policy_id | int | 1 | No | Sending policy ID |
| attributes | object | "season":"summer_2024" | No | Assigned attributes and their values |
| push_sending_mode | string | "fanout" (default) "last" | No | Push notification sending mode (push channels only) |
| Smart settings | ||||
| virtual_sender_id | int | 12 | No | Virtual sender ID (Smart accounts) |
| is_random_trk_prefix | bool | false | No | Tracking domain random prefix. (Smart accounts) |
| custom_trk_domain | JSON array | ["trk.example.com", "trk2.example.com"] | No | Tracking domains list (Smart accounts) |
| blind_carbon_copy | JSON array | ["john@example.com", "george@example.com"] | No | Hidden copy email addresses (Smart accounts) |
| unconditional_sending | bool | true | No | Send messages ignoring subscription status (Smart accounts) |
info
Unconditional sending is available only for On-premise and Off-premise licensed instances. To activate it add "unc_campaign" to EXTRAS object of main.json configuration file.
Trigger type parameters
| Parameter | Type | Description | api_call | api_import | action | update | pixel | subscribe |
|---|---|---|---|---|---|---|---|---|
| action | string | Action based trigger | No | No | Yes | No | No | No |
| update_query | JSON array | { | No | No | No | Yes | No | No |
| link_name | string | Message link name | No | No | Yes | No | No | No |
| message_id | int | Template ID | No | No | Yes | No | No | No |
| list_id | int | Database ID | Yes | Yes | No | Yes | No | No |
| subscribe_resource_id | int | Resource ID | No | No | No | No | No | Yes |
| channel | string | Subscription channel | No | No | No | No | No | Yes |
| is_new_sub | bool | New resource trigger | No | No | No | No | No | Yes |
| is_new_ch | bool | New channel trigger | No | No | No | No | No | Yes |
| is_new_contact | bool | New contact trigger | No | No | No | No | No | Yes |
| is_status_changed | bool | Subscription status change trigger | No | No | No | No | No | Yes |
| trigger_statuses | array(int) | Subscription status change options | No | No | No | No | No | Yes |
| pixel_id | int | Pixel ID | No | No | No | No | Yes | No |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"name": "New trigger campaign №1",
"content": [
{
"subject": "Maybe very important message",
"from_email": "",
"from_name": "James",
"replyto_email": "",
"replyto_name": "",
"message_id": 14
}
],
"trigger_type": "api_call",
"send_channel": "email",
"list_id": 1
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<name>New trigger campaign №1</name>
<content array='true'>
<from_email/>
<from_name>James</from_name>
<message_id>15</message_id>
<replyto_email/>
<replyto_name/>
<subject>Maybe very important message</subject>
</content>
<trigger_type>api_call</trigger_type>
<send_channel>email</send_channel>
<list_id>1</list_id>
</xml>
Response example
- JSON
- XML
{
"data": {
"saved_id": 95,
"trigger_link": "http://trk.test.test.altcraft.com:8095/trg/65512f8ec196edd6ac71fa5d068d355f65512f8ec196edd62f3de6b87e2969e3/<email|md5|xxh>"
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<saved_id>96</saved_id>
<trigger_link>http://trk.test.test.altcraft.com:8095/trg/65512f8ec196edd6fc63524eba02bff065512f8ec196edd62f3de6b87e2969e3/
<email|md5|xxh>
</trigger_link>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code |
| error_text | string | Error text |
| saved_id | int | New trigger campaign ID |
| trigger_link | string | trigger link. Only for trigger_type = "api_call" |