About Triggers
The trigger is the event that causes an automation to run. This is typically something that a visitor does on a site (for example, purchasing a product), or something a site owner does (for example, creating an invoice).
Triggers are provided by Wix apps, including apps made by Wix as well as third-party apps. You can configure triggers to be installed with your Wix app, which site owners can use in their automations. Some apps and their triggers include:
Wix app | Available triggers |
---|---|
Invoices | Invoice overdue Invoice paid Invoice sent Recurring payment starts Recurring payment canceled |
Tasks | Task overdue |
Wix Members Area | Member approved Member logs in Visitor signs up to your site |
As an app developer, you can configure triggers to be installed with your app, which site owners can use in their automations.
The main mechanism for configuring your trigger is through a payload schema, which is a JSON schema that tells Wix what data to expect in payloads. You provide your payload schema to Wix when you configure your app in the Wix Dev Center. Your payload schema contains a list of properties and their data types, as well as whether a field contains a Wix contact ID or a date-time of a scheduled event.
Overview of events
It's important to understand the difference between a trigger and an event and what all this means for your users:
- A trigger is the configuration you create for your app in the Dev Center, which causes an automation to run.
- An event is something that happens in your service, which you then report to Wix.
For more complete definitions, see Terminology in the Wix Automations API documentation.
The distinction between triggers and events is hidden from users. From your user's perspective, they interact with triggers only, whereas events are something that you handle behind the scenes. When your app reports an event, the user's automations that use the trigger are run.
Wix Automations supports two types of events for triggers: real-time events and scheduled events. Both are described in the next sections.
Real-time events
Real-time events occur at the time they're reported. Some examples of real-time events are a member joining a site or an email being opened.
Requirements:
This is the default event type for all triggers.
No special configuration is needed.
Effect on your user's automations:
Users can choose to run automations at the moment they're reported
or after a set delay.
Scheduled events
Scheduled events occur at some future time relative to the time they're reported. Some examples of scheduled event fields are an invoice due date or a session start time.
Requirements:
- The payload schema must include a property where the type is
"string"
and the format is"date-time"
. - You must specify that the date-time property contains the date-time of a scheduled event.
Effect on your user's automations: Users can choose to run automations immediately when the event is reported, or at a certain amount of time before or after the reported event.
Overview of filter fields
Filter fields allow users to filter their trigger results
based on conditions they select when configuring the automation.
The conditions can be as simple as a boolean selector,
which allows automations to run
based on whether a given payload boolean property is true
or false
.
Or it can be as complex as an item selector,
which allows automations to run only when specific forms are submitted.
To summarize: Without a filter field, an automation runs under all configured conditions, whereas a filter field allows users to suppress automations if the user-selected criteria aren't met.
The available filter fields are:
- Number: Allows users to set a number threshold for a given payload property.
- Toggle (boolean): Allows users to compare a boolean value against a payload property.
- Dropdown: Allows users to select one or more specific values from a dropdown list to compare against a payload property. You define the static list of options when you're configuring the filter field.
- Item selection: Allows users to select one or more specific items on their site from a dropdown list to compare against a payload property. The dropdown list of items is dynamically generated based on the user's site.
For more information:
- For a complete list of filter field configuration options, see Filter Fields.
- To learn how to configure a trigger with filter fields, see Add an Automations Trigger Extension.