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 |
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
{
"token": "e94ce55afc8e4e07bd64afb4427f8a5c",
"name": "New trigger campaign 3",
"content":
[
{
"subject": "Maybe very important message",
"from_email": "",
"from_name": "James",
"replyto_email": "",
"replyto_name": "",
"message_id": 8
}
],
"trigger_type": "api_call",
"send_channel": "email",
"list_id": 1
}
Response example
{
"data": {
"saved_id": 42,
"trigger_link": "http://trk.example.com:8095/trg/3a345a07f01802e7966599e657a34d023a345a07f01802e7/<email|md5|xxh>"
},
"error": 0,
"error_text": "Successful operation"
}
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" |