Create-automationRESEND_MCP_CREATE_AUTOMATION
**Purpose:** Create an automation workflow that triggers on events and executes a sequence of steps.
**When to use:**
- User wants to set up automated email sequences (welcome series, drip campaigns, re-engagement)
- User wants to automate actions based on events (update contacts, add to segments)
**Workflow:** manage-events (create event, if needed) → list-templates (to get template IDs) → get-template (to check if template has "from" and "subject" — if not, use list-domains to pick a verified domain for the step config) → create-automation → send-event (to test)
**Returns:** Automation ID and dashboard link.
The workflow is a JSON object with one key: "steps" — an array of step objects.
Each step has: key (unique string), type, config, and either "next" (string|null) or "branches" (for branching steps).
Use keys like: "trigger", "send_email_1", "delay_1", "condition_1", "wait_event_1".
## Step types
### trigger — starts the automation when an event fires (required, exactly one)
config: { "eventName": "<event_name>" }
Uses "next".
### send_email — send an email using a published template
config: { "template": { "id": "<template_id>", "variables": { "<key>": "<value>" } }, "from": "Name <sender@example.com>", "subject": "Email subject", "replyTo": "<address>" }
**"from" and "subject" are resolved from the step config first, then fall back to the template.** If neither provides a "from", the email will silently fail to send. If neither provides a "subject", the run will error. Best practice: always set "from" and "subject" on the step config so the automation is self-contained. Use list-domains to find verified domains for "from". "replyTo" and "variables" are optional. Variables can use { "var": "event.<field>" } or { "var": "contact.<field>" } for dynamic values.
Uses "next".
### delay — pause the workflow
config: { "duration": "<human-readable>" }
Examples: "30 minutes", "1 hour", "2 days", "1 week". Max 30 days.
Uses "next".
### condition — conditional split based on contact or event data
config: A condition rule object:
Single rule: { "type": "rule", "field": "event.<field>" or "contact.<field>", "operator": "<op>", "value": <value> }
Compound: { "type": "and"|"or", "rules": [<rule>, ...] }
Operators: eq, neq, gt, gte, lt, lte, contains, starts_with, ends_with, exists, is_empty.
exists/is_empty do not require a value.
Uses "branches": { "condition_met": "<step_key>", "condition_not_met": "<step_key_or_null>" }
### wait_for_event — pause until a specific event arrives or timeout
config: { "eventName": "<event_name>", "timeout": "<human-readable>", "filterRule": <optional condition rule> }
For email lifecycle events use "resend:email.<opened|clicked|bounced|delivered|complained|failed|suppressed>".
Uses "branches": { "event_received": "<step_key>", "timeout": "<step_key_or_null>" }
### contact_update — update contact fields
config: { "firstName": "<value>", "lastName": "<value>", "unsubscribed": true|false, "properties": { "<key>": "<value>" } }
All fields optional. Values can use { "var": "event.<field>" } for dynamic data.
Uses "next".
### contact_delete — remove the contact from the audience
config: {}
Uses "next".
### add_to_segment — add contact to a segment
config: { "segmentId": "<segment_id>" }
Uses "next".
## Rules
1. Every step must be reachable from the trigger via next/branches.
2. Terminal steps have "next": null (or null branch values).
3. The workflow must be tree-shaped — no merging branches back together.
## Example: Linear drip campaign
{
"steps": [
{ "key": "trigger", "type": "trigger", "config": { "eventName": "user.created" }, "next": "send_email_1" },
{ "key": "send_email_1", "type": "send_email", "config": { "template": { "id": "tmpl_123" }, "from": "Welcome <hello@example.com>", "subject": "Welcome!" }, "next": "delay_1" },
{ "key": "delay_1", "type": "delay", "config": { "duration": "3 days" }, "next": "send_email_2" },
{ "key": "send_email_2", "type": "send_email", "config": { "template": { "id": "tmpl_456" }, "from": "Welcome <hello@example.com>", "subject": "Getting started" }, "next": null }
]
}
## Example: Re-engagement with wait_for_event
{
"steps": [
{ "key": "trigger", "type": "trigger", "config": { "eventName": "user.created" }, "next": "send_email_1" },
{ "key": "send_email_1", "type": "send_email", "config": { "template": { "id": "tmpl_789" }, "from": "Team <team@example.com>", "subject": "Welcome" }, "next": "wait_event_1" },
{ "key": "wait_event_1", "type": "wait_for_event", "config": { "eventName": "resend:email.opened", "timeout": "3 days" }, "branches": { "event_received": null, "timeout": "send_email_2" } },
{ "key": "send_email_2", "type": "send_email", "config": { "template": { "id": "tmpl_abc" }, "from": "Team <team@example.com>", "subject": "Did you miss this?" }, "next": null }
]
}
## Example: Condition branch
{
"steps": [
{ "key": "trigger", "type": "trigger", "config": { "eventName": "trial.ended" }, "next": "condition_1" },
{ "key": "condition_1", "type": "condition", "config": { "type": "rule", "field": "event.converted", "operator": "eq", "value": true }, "branches": { "condition_met": "send_email_1", "condition_not_met": "send_email_2" } },
{ "key": "send_email_1", "type": "send_email", "config": { "template": { "id": "tmpl_thanks" }, "from": "Team <team@example.com>", "subject": "Thanks for upgrading!" }, "next": null },
{ "key": "send_email_2", "type": "send_email", "config": { "template": { "id": "tmpl_win_back" }, "from": "Team <team@example.com>", "subject": "We'd love to have you back" }, "next": null }
]
}