Create an Automation
This guide will cover custom event-driven data processing using Directus Automate.
Before You Start
You will need a Directus project.
Everything you need to start building. Provisioned in 90 seconds.Create a posts
collection with at least a title
and content
field. Follow the Data Modeling quickstart to learn more.
Create a Flow
Navigate to the Flows section in the Settings module. Click on in the page header and name the new flow "Post Created".
Configure a Trigger
Click on to open trigger setup. Select "Event Hook" as the trigger type and select "Action (Non-Blocking)". This will allow you to set up this flow to respond to when an event takes place by running an action that doesn't interrupt.
Select items.create
as the scope, and then check the "Posts" collection. This combination means that the operation will be triggered when an post is created.
Configure an Operation
Click on on the trigger panel.
Here, you can create an operation. Give it the name "Notify Post Created" and the key "notify_post_created" will be written alongside.
Select the "Send Notification" operation type. Fill in the "User" field with the UUID of your user, which can be found in the user directory. Under "Permissions", select "From Trigger", which will cause the operation to have the same permissions as those that came from the trigger itself.
Fill in the "Subject" and "Message" fields as desired, leaving "Collection" and "Item" blank.
When finished, click on in the flow's top right corner.
Now, when you create a post, the user you entered will be notified.
Next Steps
Read more about different triggers available in flows and how data is passed through a flow with the data chain.