trigger

Triggers receive and react to events from the system or the Event API. They contain the Zephyr logic as well as the email actions and user updates that you want to occur as a result of the specific event received.

Transactional Triggers must be associated with a specific template. They can be configured to react to any of the following events associated with a transactional send of the template: a send, open, click, purchase, or cancel. Global Triggers allow you to react to any user behavior (for example, an action on your site) that you've sent using the Event API or Purchase API. Note that as an alternative to using triggers, all of the above events can start flows in Lifecycle Optimizer, which you can configure through a visual interface rather than programmatically.

Endpoint URL: https://api.sailthru.com/trigger

Transactional Triggers

Transactional triggers are specific to a template and event type. For each, in addition to the template name and event type, you will specify a relative time and any Zephyr code to run. For example, this trigger will accomplish the following: When the "purchase receipt" template is sent, wait one day and six hours time, then run the Zephyr to send a follow-up template:
{    
 "event" : "send",    
 "time" : "+1 day 6 hours",    
 "template" : "purchase receipt",    
 "zephyr" : "{api_send({'template':'post-purchase follow up'})}" 
}

Global Triggers

Global triggers are initiated by the Event API and are associated with a specific event type. For example, each time a user favorites an item on your site, you can make an Event API call with the event name "favorite" along with any user-specific data, and any trigger listening for the event name "favorite" will run.  Global triggers require an event name, relative time, and zephyr code. For example:
{    
    "event" : "will_attend_concert",    
    "time" : "-1 day",    
    "zephyr" : "{api_send({'template':'reminder','vars':event.vars})}"
}
Note: There is no need to pre-establish an event name in the system--simply submit an event by a consistent name when it occurs. No action will be taken unless a trigger, Smart Strategies, or Lifecycle Optimizer, has been configured to listen for that event name. You may want to begin sending events as a first step prior to programming the actions that should be taken upon their receipt.

Custom Zephyr Scripts as Actions

The zephyr parameter is used for a custom Zephyr script. A trigger's possibilities are immensely increased when used with a Zephyr custom script. There are two special functions you can include with a trigger:
  • api_user - For updating user profiles
  • api_send - For sending transaction email
Making use of profile and message objects along with Zephyr can be quite powerful.

GET Mode

Optional Parameters

Parameter Description Example
template Name of the template welcome
trigger_id Trigger ID 4e2f17e46803fa2847000000
event Event Name user.register

Pass any of the above parameters to query your triggers by them, or pass no parameters and get all the triggers in the system.

Return Value

Field Description Example
template Name of the template welcome
triggers List of trigger items
Each trigger item has the following structure:
Field Description Example
trigger_id Trigger ID 4e2f17e46803fa2847000000
time Trigger time something like 10 mins 2 days 75 minutes
event Event - can occur on click, open, send, purchase or cancel click
zephyr Zephyr Syntax {api_send("template_name")}

POST Mode

Create a trigger

Required Parameters

Parameter Description Example
template Name of the template welcome
time Trigger time, must be integer value 10
time_unit Trigger time unit - can be minutes, hours or days minutes
event Event - set to occur on click, open, send, purchase or cancel send
zephyr Zephyr syntax {api_send("template_name")}
OR
Parameter Description Example
event Name of the event user.register
time Trigger time, must be integer value 10
time_unit Trigger time unit - can be minutes, hours or days minutes
zephyr Zephyr syntax {api_send("template_name")}

Return Value

Same as GET mode

DELETE Mode

Delete single trigger or all triggers that exist on a template
Parameter Description Example
template Name of the template welcome

Optional Parameters

Parameter Description Example
trigger_id Trigger ID 4e2f17e46803fa2847000000
If trigger_idparameter is not present, all triggers associated with the template will be deleted

Return Value

Same as of GET mode

Contact us

Top