Prerequisites
- A business with customers. See Sync businesses and customers.
- Your
project_idandsecret_key. See Authentication.
1. Define the event
Define the event once for your project. Give it a name and a phrase that completes the sentence “When…”, which is what businesses see when they choose what a trigger listens for. In the dashboard, open Resources > Triggering Events and create a new event. Or use the API:id, which starts with pde_.
2. Track the event
When the event happens in your product, send it for the business it happened in. Setevent to the event’s id or its name, and identify the customer inside
data.
id. The request succeeds as
soon as the event is stored. Matching it to a customer and to triggers happens
afterwards.
You can identify the customer by your own identifier, as above, or by the
Pocketflows ID. See
Tracking event payload examples.
Include any other details in data that a business might want to filter on or
mention in a message.
3. Set up a trigger for the business
A business sets up its own trigger in the embed:- Create an embed for the business and open Triggers.
- Create a trigger and choose your event, shown as “When a customer books an appointment”.
- Add the messages to send and activate the trigger.
4. Check that it worked
Track the event again for a customer of that business, then look up what it did:customer is the ID of the customer the event was matched to. It is null
until the event has been processed, and stays null if no customer matched.
Troubleshooting
If the event started nothing, check these in order:customerisnullon the event. The identifier indatadoes not match a customer of this business. Customers belong to one business, so check that you tracked the event for the business the customer was synced into.- The event name does not match. The
eventyou sent must be theidor the exacteventname of a project-defined event in the same project. Test mode and live mode are separate projects, each with its own events. - No trigger is active. The business has no active trigger listening for this event, or the trigger’s filter excludes this customer or event.
Related
- How events and triggers work for what happens after an event is tracked.
- Tracking event payload examples for request bodies.
- How personalization variables work to use event data in a message.