Workflows
Automations that send templates, wait, branch on a contact and call webhooks, started by events, audience changes, email activity or a schedule.
A workflow is a trigger and a set of steps. Each time the trigger fires for a contact, a
run walks the steps: it sends templates, waits, checks the contact against a segment
rule, changes the contact and calls your webhooks. Workflows are an exx extension. Resend's
Automations API has a different shape (steps joined by connections, at /automations), so
workflows use exx's own endpoints; the SDK methods take Resend's names where the two share
an operation (create, get, list, update, remove, duplicate, runs.list,
runs.get).
Every change needs a full-access API key (or the dashboard's send permission); reading
needs read. A sending-only key reaches none of it.
Draft, publish, run
A workflow starts as a draft: save any definition, even an incomplete one, while you build it. Publishing checks the draft and stores it as the next immutable version; the workflow is then active. A run keeps the version it started on until it ends, so editing and republishing never changes a run under way.
curl https://api.exx.sh/workflows \
-H "Authorization: Bearer $EXX_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name": "Welcome series", "definition": {"version": 1,
"trigger": {"type": "event", "event": "user.signed_up"},
"start": "welcome",
"steps": {
"welcome": {"type": "send", "template": "welcome", "next": "wait"},
"wait": {"type": "wait", "duration": "3d", "next": "done"},
"done": {"type": "exit"}}}}'
curl -X POST https://api.exx.sh/workflows/$WORKFLOW_ID/publish \
-H "Authorization: Bearer $EXX_API_KEY"Publishing refuses a draft that has a problem and names where it is
(`steps.welcome.template` names no published template of this project):
- every step must be reachable from
start, and everynextmust name a step; - a
conditionneeds bothyesandno, await_for_eventbothnextandtimeout_next; - no step may lead back to an earlier one: a run takes each step at most once, so every
path ends at an
exit. To run a contact through again, use re-entry (below); - waits and timeouts must be positive and within
limits.toml [workflows] max_run_age; - templates must be published, and segments, topics, properties and rules must exist in the project; webhook URLs must be ones exx calls (public HTTPS hosts).
GET /workflows/schema returns the definition's JSON Schema, and the
OpenAPI document lists every endpoint. POST /workflows/{id}/pause stops new runs
(runs under way go on); resume makes it active again; duplicate copies the draft.
Triggers
trigger.type | Starts a run when |
|---|---|
event | the contact's application event event is recorded |
contact_created | a contact is created (by the API, an import or an event) |
segment | the contact joins or leaves (on: "joined" or "left") segment_id; for a dynamic segment, when a change to the contact's profile (fields, properties) makes its rule true or false. A topic choice or new activity that changes the rule's answer starts nothing: use a topic or email trigger for those |
topic | the contact's choice of topic_id changes (to to, when given) |
doi_confirmed | the contact confirms double opt-in |
email | email activity of the contact: event is email.sent, email.delivered, email.opened, email.clicked, email.bounced, or email.received (mail from the contact's address to the project; only authenticated mail, DMARC or an aligned SPF pass, and never automatic mail such as auto-replies) |
schedule | cron (five fields) comes in timezone (an IANA name), once for each contact of segment_id, or once with no contact |
date | a date property plus offset comes ("offset": "-3d": three days before trial_ends_at) |
property | a property's value changes (from from, to to, when given) |
api | only POST /workflows/{id}/runs starts it |
One occurrence starts a workflow once: a retried event, a repeated signal or a second process never starts a second run from it. In a time zone's daylight-saving gap a schedule fires at the first valid time after it; in the repeated hour it fires once, at the first occurrence.
Any active workflow can also be started from the API, for a contact (contact_id or
email). An Idempotency-Key starts at most one run per key; repeating the request
answers the same run:
curl https://api.exx.sh/workflows/$WORKFLOW_ID/runs \
-H "Authorization: Bearer $EXX_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: onboarding-42' \
-d '{"email": "customer@example.com", "data": {"plan": "pro"}}'Steps
type | Does |
|---|---|
send | sends template (an id or alias, its published version) to the contact; from, subject and topic_id are optional |
wait | waits duration (30m, 12h, 3d) |
wait_until | waits until time (HH:MM) in the contact's time zone (else the project's), on days when given (["mon", "wed"]) |
wait_for_event | waits for the contact's event (an application event name, or email.opened, email.clicked, … of the last email the run sent) up to timeout; then next, or timeout_next |
condition | checks the contact against rule, a segment rule; then yes or no |
update_contact | sets properties (declared ones), first_name, last_name |
add_to_segment, remove_from_segment | changes a static segment's members |
webhook | POSTs a signed JSON body to url |
exit | ends the run |
A send goes through the same pipeline as a broadcast's mail: unsubscribed and
suppressed contacts, a topic they opted out of and a double opt-in they have not confirmed
(the trigger's segment, or any double opt-in segment they are in) are skipped (the run
goes on), and the project's frequency cap applies, counting
broadcasts and workflow sends together. Mark a step "exempt_from_frequency_cap": true
for mail the contact expects (a receipt-like series); consent and suppressions still apply.
The template renders with the contact's values and unsubscribe link, as a broadcast does,
and its own variables take the triggering event's properties. Publishing runs the
template through the content scan: a template that links a listed domain is refused.
Workflow mail is marked Auto-Submitted: auto-generated.
A webhook request is signed like exx's webhooks (Standard Webhooks
headers), with the workflow's signing_secret (in GET /workflows/{id} with an API key;
in the dashboard, rotate it with POST /workflows/{id}/signing-secret/rotate to see a new
one). Its svix-id
and Idempotency-Key header are the same on every attempt: deduplicate on them, since a
retry can reach you twice. Failed requests are retried on the webhook schedule, at most
limits.toml [workflows] webhook_attempts times. URLs must be public HTTPS hosts, and a
project's webhook steps are rate-limited ([workflows] webhook_*). The body:
{"type": "workflow.step", "created_at": "2026-11-21T12:00:00.000Z",
"data": {"workflow_id": "…", "run_id": "…", "step_id": "notify", "execution": 5,
"contact": {"id": "…", "email": "customer@example.com", "properties": {}},
"trigger": {"event": {"name": "user.signed_up", "properties": {}}}}}Re-entry, throttle and loops
reentry says whether a contact may run the workflow again:
{"mode": "once"}(default): one run per contact, ever;{"mode": "after_completion", "interval": "30d"}: again once the last run ended (and, withinterval, at least that long after it started: once per 30 days);{"mode": "always"}: any number of runs at once.
"throttle": {"runs": 1000, "per": "1h"} refuses starts past that many runs in any hour;
the workflow counts them (throttled). A workflow that may re-enter (always, or
after_completion without interval) and sets no throttle gets the default one
(limits.toml [workflows] default_throttle_runs per default_throttle_per). A project
has at most limits.toml [workflows] max_concurrent_per_project runs under way (runs
waiting for an event do not count): a start past it is put off and tried again, never
dropped (deferred; from the API, a 429 to retry with the same key).
Workflows cannot loop. What a step changes (a property, a segment membership) carries
the run's chain, and so do the activity of the mail a run sent and received mail that
answers it: a workflow is never started again in its own chain, and chains across
workflows stop at limits.toml [workflows] max_chain_depth (counted as refused).
Runs
GET /workflow-runs lists runs, newest first, by workflow_id, status (running,
waiting, completed, canceled, failed) or contact_id. GET /workflow-runs/{id}
adds the run's timeline: every step it executed, in order, with what it did (the
message_id of a send, why one was skipped, until when a wait waits, a webhook's
delivery; a caller without the audience permission gets the trigger and results empty,
since they name people). POST /workflow-runs/{id}/cancel cancels one run and
POST /workflows/{id}/cancel-runs every run of a workflow; mail already accepted and
webhook requests already made are not recalled. Ended runs are kept for
retention.toml [global] workflow_runs.
In the SDKs the same operations are workflows and its versions and runs
(TypeScript shown; Python, Go and Rust name them the same way in their own case):
const { data: workflow } = await exx.workflows.create({ name: "Welcome series", definition });
await exx.workflows.publish(workflow.id);
await exx.workflows.runs.start(
workflow.id,
{ email: "ada@example.com", data: { plan: "pro" } },
{ idempotencyKey: "signup-ada" },
);
const { data: runs } = await exx.workflows.runs.list({ workflowId: workflow.id });Recipes
Welcome series
Send a welcome, wait three days, send tips only to those who have not ordered:
{"version": 1,
"trigger": {"type": "event", "event": "user.signed_up"},
"start": "welcome",
"steps": {
"welcome": {"type": "send", "template": "welcome", "next": "wait"},
"wait": {"type": "wait_for_event", "event": "order.completed", "timeout": "3d",
"next": "done", "timeout_next": "tips"},
"tips": {"type": "send", "template": "getting-started", "next": "done"},
"done": {"type": "exit"}}}Trial ending
Three days before trial_ends_at (a date property), at 09:00 in the contact's time zone:
{"version": 1,
"trigger": {"type": "date", "property": "trial_ends_at", "offset": "-3d"},
"start": "morning",
"steps": {
"morning": {"type": "wait_until", "time": "09:00", "next": "paid"},
"paid": {"type": "condition", "rule": {"property": "plan", "op": "eq", "value": "pro"},
"yes": "done", "no": "remind"},
"remind": {"type": "send", "template": "trial-ending", "next": "done"},
"done": {"type": "exit"}},
"reentry": {"mode": "after_completion"}}Re-engagement
Every Monday at 10:00 in Berlin, for a dynamic segment of contacts without a click in 90 days: one nudge, and a webhook to your CRM for those who click.
{"version": 1,
"trigger": {"type": "schedule", "cron": "0 10 * * 1", "timezone": "Europe/Berlin",
"segment_id": "SEGMENT_ID"},
"start": "nudge",
"steps": {
"nudge": {"type": "send", "template": "we-miss-you", "next": "clicked"},
"clicked": {"type": "wait_for_event", "event": "email.clicked", "timeout": "7d",
"next": "crm", "timeout_next": "done"},
"crm": {"type": "webhook", "url": "https://crm.example.com/hooks/reengaged", "next": "done"},
"done": {"type": "exit"}},
"reentry": {"mode": "after_completion", "interval": "90d"}}