Understanding ECA concepts¶
ECA (Events - Conditions - Actions) models help you automate business processes in Drupal by responding to events that happen on your site. Think of ECA as a watchful assistant that can detect when something happens, check if certain conditions apply, and then take appropriate actions.
Core components¶
Events¶
Events are triggers that start an ECA process. These could be things like:
- A user logging in
- Content being created or updated
- A form being submitted
- A scheduled time arriving
- A custom event you define
When an event occurs, ECA checks if any models are listening for that event and runs them if so.
For a detailed guide on event types, token availability, and how to add events to models in each modeler, see the dedicated Events page.
Conditions¶
Conditions are checks that determine whether actions should run. They act as filters or guards, ensuring actions only happen when appropriate. For example, you might want to:
- Check if a user has a specific role
- Verify content has certain field values
- Ensure a threshold has been met
- Compare dates or times
- Combine multiple conditions with AND/OR logic
Conditions go on connections
A common point of confusion for newcomers: conditions are not standalone elements on the canvas. Instead, they are attached to the connections (edges) between components. See the Conditions page for details on how to add them in each modeler.
Actions¶
Actions are the tasks ECA performs when an event occurs and conditions are met. Actions can:
- Create or update content
- Send notifications
- Modify user accounts
- Interact with external systems
- Trigger other events
- Perform custom operations
For a detailed guide on action categories, chaining, token interaction, and how to add actions in each modeler, see the dedicated Actions page.
How components work together¶
Let's look at a common example: sending a welcome email to new users in a specific role.
- Event: User account is created
- Condition: User has the "member" role
- Action: Send customized welcome email
ECA processes this flow by:
- Detecting the account creation event
- Checking the user's roles
- Sending the email if the condition is met
Next steps¶
Learn more about specific concepts:
- Events -- types of events, tokens they provide, and how to add them
- Conditions -- condition types, negation, AND/OR logic, and how to add them
- Actions -- action categories, chaining, token interaction, and how to add them
- Managing permissions
- Understanding tokens
- Using loops
- Working with custom events
- Entity events
- Using gateways
For practical examples, visit our model library.