Skip to main content
A campaign is sent when a business decides to send it. A trigger is sent when something happens: a customer books an appointment, abandons a cart, or has a birthday. You tell Pocketflows that it happened by tracking an event, and each business decides what to send in response by setting up a trigger. To set this up, see Send messages when something happens in your product.

Events and triggers

  • An event is a record that something happened to one customer of one business, along with any data about it.
  • A trigger belongs to a business. It names the event it listens for, an optional filter, and the steps to run: sending an email or SMS, waiting for a set time, or continuing only if a filter matches. See Build segments and triggers with the API.
Your platform owns the events, because only you know when something happened. The business owns the triggers, because it decides how to respond. This split is what lets every business on your platform automate its own marketing from the same integration.

Two kinds of event

Project-defined events are the ones you define and track, such as appointment.booked. You define each one once for your whole project, with a phrase that completes the sentence “When…”, such as “a customer books an appointment”. That phrase is what businesses see when they choose what a trigger listens for. Built-in events are raised by Pocketflows itself, so you do not track them:

What happens when you track an event

Tracking an event stores it and returns straight away. The rest happens in the background:
  1. Pocketflows finds the customer the event is about, using the identifier in the event’s data.
  2. It finds the project-defined event that matches the event you sent.
  3. It finds the business’s active triggers that listen for that event.
  4. For each trigger, it checks the trigger’s filter against the customer and the event’s data.
  5. For each trigger that matches, it starts running the trigger’s steps for that customer.
An event that gets through all five steps produces one trigger execution per matching trigger. Each tracked event is handled separately, so tracking the same event twice runs the trigger twice. To retry a track request safely, send an idempotency key.

Why an event can do nothing

A tracked event is always stored, but it only sends something if every step above succeeds. It does nothing when:
  • no customer in the business matches the identifier you sent,
  • the event does not match any project-defined event in your project, or
  • the business has no active trigger listening for that event.
None of these is an error, and the track request still succeeds. This is by design: you can start tracking an event for every business before any of them has set up a trigger for it.

Event data

The data you send with an event is available to the trigger in two ways:
  • As filters, so a trigger can run only for some events, such as bookings for a particular service. See event filters.
  • As variables, so a message can include details of the event, such as the appointment time. See How personalization variables work.
An event can also carry a purchase amount, which Pocketflows uses to attribute revenue to the marketing that drove it. See How ad attribution works.