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.
Two kinds of event
Project-defined events are the ones you define and track, such asappointment.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:- Pocketflows finds the customer the event is about, using the identifier in
the event’s
data. - It finds the project-defined event that matches the
eventyou sent. - It finds the business’s active triggers that listen for that event.
- For each trigger, it checks the trigger’s filter against the customer and the event’s data.
- For each trigger that matches, it starts running the trigger’s steps for that customer.
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
eventdoes not match any project-defined event in your project, or - the business has no active trigger listening for that event.
Event data
Thedata 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.
Related
- Send messages when something happens in your product for the steps.
- Tracking event payload examples for the request bodies.
- Give businesses pre-built campaigns, triggers and emails to ship a ready-made trigger for an event.