Drupal
min read
Last update on

Automating workflows in Drupal with ECA (Event-Condition-Action)

Automating workflows in Drupal with ECA (Event-Condition-Action)
Table of contents

Automation is at the heart of modern web development, allowing websites to streamline operations, enhance user experience, and reduce manual intervention. 

Drupal, being a powerful CMS, has long supported automation through modules like Rules in Drupal 7. 

However, with Drupal 8+ transitioning to Symfony and modern object-oriented programming, the Rules module struggled to keep up. To fill this gap, the ECA (Event-Condition-Action) module was introduced as a no-code automation framework that offers a flexible, graphical, and user-friendly way to define workflows.

What is ECA?

ECA stands for Events - Conditions - Actions, and it follows a simple paradigm:

  • Event → A trigger, such as a user logging in, submitting a form, or creating new content.
  • Condition → A check that determines whether an action should be executed (e.g., verifying user roles or content types).
  • Action → The task to be performed, such as sending an email, redirecting a user, or modifying content.

ECA allows site builders to configure complex workflows without writing a single line of code, making it a game-changer for automation in Drupal.

History of ECA

Before ECA, the Rules module was widely used in Drupal 7 to set up automated workflows. However, with the architectural changes in Drupal 8 and beyond, Rules struggled with compatibility and performance. 

As a result, ECA was introduced as a modern, flexible alternative that integrates seamlessly with Drupal’s API and object-oriented architecture.

ECA modellers

ECA provides multiple workflow modellers, allowing users to design automation visually. The available modellers include:

1. BPMN.iO (recommended modeller)

A JavaScript-based BPMN (Business Process Model and Notation) modeller integrated directly into the Drupal admin UI. It offers an intuitive drag-and-drop interface for defining workflows.

2. Camunda modeller

A desktop-based modeller that allows users to create BPMN workflows externally and import them into Drupal. Useful for complex workflows requiring offline editing.

3. ECA classic modeller

A form-based workflow modeller that uses Drupal Core’s Form API. Best suited for developers who prefer configuration-driven workflow automation.

Simple ECA model in Drupal

The Event-Condition-Action (ECA) module in Drupal allows you to create automated workflows based on user actions. In this guide, we will walk through setting up a simple ECA model using the BPMN.iO modeller. This model will display a thank-you message whenever a new article is created.

Step 1: Access the ECA module

  1. Navigate to Configuration > Workflows > ECA in your Drupal admin dashboard.
  2. You will see an overview of all existing ECA models.
  3. Click the "Add new model" button to create a new model.
Configure ECA

Step 2: Understanding the ECA interface

The main ECA interface consists of:

  • A graphical modeller powered by BPMN.iO.
  • Events, conditions, and actions represented by different shapes:
    • Event (StartEvent) – Circle
    • Condition (Gateway) – Diamond
    • Action (Task) – Rounded rectangle
    • Sequence Flow – Arrows connecting events to actions
  • Note: Sequence flows can be used with conditions or without conditions
  • A property panel on the right-hand side to configure settings
ECA interface

Step 3: Naming your model

  1. In the property panel, enter a name for the model, such as "Display a message to user editors when a new article is created.".
ECA interface

Step 4: Creating an event

  1. Drag a circle (StartEvent) onto the canvas.
ECA interface
  1. Name the event "Article has been created" in the property panel.
  2. Click "+Select" next to "Template."
ECA interface
  1. Choose "Insert content entity (After a new entity has been saved)" from the dropdown.
ECA interface
  1. In the property panel, limit the content entity type to "Article".

Step 5: Creating an action

  1. Click the small rectangle connected to the event.
ECA interface
  1. Name the action "Display a message" in the property panel.
  2. Click "+Select" next to "Template" and choose "Display a message to the user".
ECA interface
  1. In the Custom properties section, enter the message text: "Thank you for  [node: title]".
  2. Since [node: title] is a token, select "Yes" for Replace tokens.

Step 6: Creating condition

ECA interface
  1. Click on the sequence flow (arrow connecting the event and action).
  2. Name the condition "Show a message only to users with the editor role" in the property panel.
ECA interface
  1. Click "+Select" next to "Template" and choose "Role of the current user"

ECA interface
  1. In the property panel, select the user role as "Content Editor". This ensures only users with this role see the thank-you message.

Step 7: Saving and testing

  1. Click "Save" to store your model.
  2. Create a new article in Drupal.
Saving and testing ECA
  1. After saving, a message "Thank you for [node: title]" should appear on the website.

This simple ECA model demonstrates how you can automate workflows in Drupal using the ECA module. You can extend this model by adding more conditions or actions to customise its behaviour further.

Conclusion

Drupal’s Event-Condition-Action (ECA) module, combined with BPMN.io, is shifting from visual automation to AI-powered decision-making. Site builders can create no-code workflows that use models like GPT to generate summaries, improve metadata, and flag moderation issues automatically and in real time.

Used on over 8,000 sites, BPMN.io workflows are gaining traction in Europe with developers like LN Webworks and Code Enigma. They are applying AI-enhanced ECA for content strategy, personalisation, and quality assurance, especially in sectors with multilingual needs or lean teams.

This is not just a trend. Drupal is building modular, intelligent systems where AI becomes part of how websites operate. More on The Drop Times.

For more help, check out these resources:

Written by
Editor
Ananya Rakhecha
Tech Advocate