Directus Flows: Automate Complex Data Processes for Your Digital ProjectsBy Rijk van Zanten on June 16, 2022
Data is the life-blood of any digital project – and the Directus Open Data Platform is all about democratizing data so that you can access and use it to create amazing digital experiences, internal apps, and SaaS offerings. But with data being generated from various sources at unprecedented rates, automating data workflows is essential to eliminating manual tasks that can slow you down and inhibit innovation.
Enter Flows, a new feature in the Directus platform that makes it fast and easy to implement custom event-driven data processing and workflow automation. Whether a data operation is being initiated manually, in response to an action within your app, or because of an incoming webhook from an external app, Directus Flows enable the seamless flow of data based on user-defined triggers and conditions.
No-Code Drag-and-Drop Interface
Directus Flows are extremely flexible and easy to configure. Using a simple no-code interface, you can connect any number of operations to create simple or complex workflows that execute automatically in response to a trigger. Operations include any actions performed following the trigger, such as checking conditional logic, creating or transforming data, sending emails and notifications, saving to console logs, or triggering other flows, just to name a few.
With Directus Flows, you can build automation workflows in minutes, however complex, that fire as soon as the trigger event occurs. Each time it runs, the data payload moving through the flow can be checked, manipulated, alerted on, sent to external systems, or even passed along to other flows. Data Flows can also be triggered via inbound webhooks, and it can also send outbound webhooks to enable deep integration with other mission-critical systems. This makes it even easier to connect, virtualize, and act on data from other sources.
Creating a Flow
Flows are configured as draggable operations, each connected with directional arrows to represent the flow’s conditional logic. Once the operations are connected and the flow is made active, it will run automatically every time the selected trigger event occurs.
When you create a flow, the first step is to define the trigger that will begin the automation. Examples of triggers include:
- When a user logs into Directus
- When a user manually presses a button
- When data is created, changed, or deleted
- When a new file is uploaded
- When an article or piece of content is published
- When a new customer is added
- If an event happens in another system
- A time interval (i.e. 10 minutes, daily, Mondays at noon, etc.)
- …or any other system event or data interaction
After you define the trigger, you can use the intuitive drag-and-drop interface to configure any number of conditions and operations to complete the workflow.
Say you want to automate a content workflow with built-in alerting. First, you create a flow and set the trigger to fire when content is created or updated. Then, you can add operations to change the status to “Under Review” and email your team with a notification asking for approvals.
Here are a few other examples of flows that you can automate:
- Alert your team when a business metric passes a certain limit
- Create content workflows with emails for reviews or approvals
- Deploy your static site when content is created or updated
- Add Stripe's key to customer data when a credit card is added
- Each hour, ingest data from another service's API
- Automatically prune legacy data after a million records
The possibilities are endless!
Conditions, Error Catching, and Processes
Despite each flow having a single trigger, the payload may be different each time the flow runs. To route this dynamic data properly, you can add conditions to your logic. This enables you to create simple flows that can handle complex data.
What if something fails along the way? Operations have a single “input” connector where data enters; however, there are two output connectors: “resolve” and “reject.” The resolve connector continues with business as usual, while the reject connector is a catch for any failures within that operation. This means you can avoid dead ends in your flow by handling any errors that may arise.
With all this power and flexibility, you might be wondering how you can keep elaborate flows organized and DRY (Don't Repeat Yourself)? Luckily, complex processes can be broken up into a number of simpler “task” flows, each capable of triggering the abstracted logic in other flows. Interconnecting flows takes things to a new level and helps normalize your automation.
For example, if a flow for your SaaS is supposed to update Stripe every time a new customer is created but the operation fails for some reason, you can catch the error and email response details to your Support team, so they can address the problem immediately. Meanwhile, you can trigger a separate flow that notifies your customer of the issue and sets their account to be temporarily disabled until the issue is resolved.
A Blank Canvas for Governing Data Operations
Directus Flows is a blank canvas where you can automate simple tasks or build complex processes. It’s intentionally broad and flexible, to provide support for innumerable use cases. What’s more, because flows are configured using our no-code app, fewer technical administrators are needed to build out robust data workflows.
Most importantly, Directus Flows eliminates much of the boilerplate work associated with repetitive development tasks, replacing the need to develop custom code for completing data operations. This frees up developers’ time to focus on creating innovative digital projects, while enabling faster time-to-market with their solutions.
Learn more about Directus Flows and how to get started by reading our technical documentation.