Lifecycle events allow you to trigger flows based on arbitrary events, including events generated by integrations, instead of relying on user input to launch flows. In this guide you’ll learn how to create events and handle them.
- Create a flow called
lifecycle.yamland add the following code:
triggers: - keyword: lifecycle steps: - say: Here's a lifecycle event... - lifecycle: foo text: bar # Optional - say: Done.
Run the following commands in your terminal:
Save the file.
In this flow, the lifecycle component will create an event with a
text property allows you to display text to the user when the event occurs, if you wish.
For the full definition of the component, check out the documentation here: Lifecycle component
- Push the new flow to the app:
- Test out the new flow in the simulator:
You can setup lifecycle triggers that listen for events with a matching
- Create a new flow called
event.yamland add this code:
triggers: - lifecycle_id: foo steps: - say: This is the event flow triggered by the foo lifecycle event.
meya format in your terminal, then save.
- Push the code to your app:
- Test the trigger by running the
lifecycle.yamlflow in the simulator:
If you run the flow multiple times you’ll notice the message from
event.yamlmay occur either before or after the
Done.message. Flows triggered by lifecycle events run asynchronously.
For more information on the lifecycle trigger, check out the documentation: Lifecycle trigger
You can search for lifecycle event entries in the logs using this GridQL query:
You can also search for events with a particular
Here’s an example lifecycle event log entry:
Updated 6 days ago