1. Home
  2. Docs
  3. REST API
  4. API Reference
  5. Triggers

Triggers

A triggering event may have multiple triggers associated with it, so many different actions may be undertaken automatically by the system. Using triggers is a great way to build in email marketing automation capabilities to your solution, as groups and lists and custom fields can all be used in the API-initiated or UI-initiated email campaigns.

A trigger is an action that takes place when one of the following events takes place:

  • A subscriber activates a subscription to a list;
  • A subscriber unsubscribes from a list;
  • A subscriber finishes and autoresponder / funnel sequence.

Triggers are associated with a FeedBlitz list.

When an event on a list occurs that matches the list’s triggers, the trigger can take one of the following actions:

  • Subscribe a user to a different list
  • Unsubscribe a user from a list
  • Unsubscribe a user from all lists owned by the publisher
  • Add the user to a group
  • Remove the user from a group
  • Set or remove a tag or custom field
  • Call a web hook

The following resource are available:

/triggers/<listid>
/triggers/<listid>/<triggerid>

GET Method

Retrieves the XML for all triggers for the list, or for the individual trigger.  Returned XML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<feedblitzapi version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
<rsp stat="ok">
<success code="0" msg="Authorized" />
</rsp>
<triggers>
<id>797935</id>
<trigger>
<id>887</id>
<event>Unsubscribe</event>
<action>UnsubscribeFrom</action>
<listid>806207</listid>
</trigger>
<trigger>
<id>888</id>
<event>Unsubscribe</event>
<action>UnsubscribeFrom</action>
<listid>914313</listid>
</trigger>
… etc …
</triggers>
</feedblitzapi>

The <id> at the <triggers> level is the list id these triggers are associated with, so in this case the triggers are associated with list (syndication) ID 797935.

Trigger Entry Elements

ElementComment
idFeedBlitz assigned ID for the trigger
eventThe event this trigger is linked to. Valid options are:

Subscribe
Unsubscribe
Finish

Event types are case insensitive; finish only applies to autoresponders (funnels).
actionThe action to take when the specified event occurs. Valid actions are:

SubscribeTo
UnsubscribeFrom
UnsubscribeFromAll
Webhook
Field
GroupAdd
GroupRemove
listidThe list affected by the SubscribeTo or UnsubscribeFrom actions. If the action is “UnsubscribeFromAll” this value will be 0 or * and can be ignored.
webhookFor the “Webhook” action, the URL to which subscriber data will be POSTed.
fieldinfoFor “Field” actions, this value is <fieldid>|<data_to_set>
groupidFor GroupAdd and GroupRemove actions, this is the group ID of the group being changed.

Note that trigger actions do not cascade. i.e. if a subscriber joins List A, and one of the actions is to remove them from List B, unsubscribe triggers on List B are not executed.

Webhooks POST <subscription> XML to the URL specified with information about the subscriber. To differentiate between different events, provide different URLs or parameters in the URL for your app to interpret.

DELETE method

You can delete at either of the trigger resource levels. Deleting an individual trigger ID leaves other triggers intact; deleting at the list level removes them all.

POST Method

Edits one or more triggers.

If you POST XML to a given trigger id resource, the ID specified in the XML you post (which is optional) must match the trigger ID in the resource path. Posting updates to the list id level will edit all the trigger IDs specified in the XML. You may specify only the element(s) you wish to change within an individual trigger; the other elements will be populated by the current values.

PUT Method

Creates new triggers.

You may PUT to either level, they do the same thing (the trigger ID in the resource path will be ignored if you specific it).  Any trigger IDs specified in the XML will be ignored; FeedBlitz will assign IDs if the PUT is successful, and return them to you.