Workflows
Build multi-step automation with visual workflows — trigger on record changes, webhooks, or schedules.
What are workflows?
Workflows are multi-step automations that run inside Sevro. A workflow is a directed graph of nodes — each node does something (call a method, evaluate CEL, make an HTTP request, send an email) and passes data to the next node.
Workflows are defined as part of a module, just like entities and methods. They are declarative configuration, not code.
When to use workflows
- Send a notification when a record changes (e.g. email the customer when an invoice is marked paid)
- Sync data to an external system via a REST connection (e.g. push new orders to an accounting API)
- Run scheduled tasks (e.g. every night, check for stale records and update their status)
- React to webhooks from external services (e.g. Stripe payment received → create a record)
- Multi-step business processes (e.g. on approval, create a follow-up task, send an email, and update a status field)
Workflow structure
A workflow consists of:
- Trigger — what starts the workflow (record event, webhook, schedule, or manual)
- Nodes — the steps to execute. Each node has a type and configuration.
- Edges — connections between nodes defining execution order.
- Input — data passed into the workflow at runtime.
Node types
| Node type | What it does |
|---|---|
| Method call | Execute a method on an entity (create, update, or custom method) |
| CEL expression | Evaluate a CEL expression and use the result |
| HTTP request | Call an external API via a REST connection |
| Send email | Send an email via an SMTP connection |
| Delay | Wait for a duration or until a specific time |
| Branch | If/else logic based on a CEL condition |
| Iterator | Loop over an array of items |
Defining a workflow
Workflows are defined in module YAML files:
name: invoicing
entities:
- ref: invoice
# ... entity definition ...
workflows:
- ref: notify-on-paid
label: Notify on Paid
trigger:
type: record_event
entity: invoice
event: updated
condition: "record.status == 'paid'"
nodes:
- id: send-email
type: send_email
connection: smtp-default
config:
to: "{{ record.customer_email }}"
subject: "Invoice {{ record.id }} has been paid"
body: "Your invoice has been marked as paid. Thank you!"Executing workflows
Workflows can be executed:
- Automatically — when the trigger condition is met
- Manually — via the CLI or API
# Execute a workflow manually
sevro workflow execute \
--module <module-id> \
--workflow notify-on-paid \
--input '{"record_id": "abc-123"}'Workflow status
Check the status of a workflow execution:
sevro workflow status --execution-id <execution-id>The response includes the status of each node, the overall output, and any errors.
Next steps
- Triggers — full reference for trigger types and conditions
- Connections — configure REST and SMTP connections
- CEL expressions — write conditions and transformations
- CLI reference — workflow commands