---
title: "Automation blocks"
description: "Every automation block with its settings, the paths out of it and the data it leaves for later blocks: sends, waits, branches, updates and webhooks."
url: https://www.unitpost.com/guides/automations-blocks
section: Guides
updated: 2026-11-29
---
# Automation blocks

## Automation blocks

> Every automation block with its settings, the paths out of it and the data it leaves for later blocks: sends, waits, branches, updates and webhooks.

Blocks come from the same catalog the validator and the engine use. Action blocks count toward a run's step budget (50 by default) and make the run billable; triggers, waits, branches and exits are free. Publish refuses a path with more action blocks than the budget (`path_over_action_limit`), and an automation holds at most 100 blocks. `GET /v1/automations/catalog` returns the same list as JSON.

### Send email

`action.email.send`. Renders a template and sends it to the run's contact (or a fixed address), through the full sending gate.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `templateId` | Yes | text | PUBLISHED template id (tmpl_… or bare). |
| `from` | Yes | text | Sender on a verified domain: "Acme <hi@acme.com>" or bare address. |
| `topicId` | No | text | Consent gate: skip contacts not subscribed to this topic. The global unsubscribe already applies to every marketing template without one; a topic adds a per-topic opt-out (and needs a marketing template). |
| `transactional` | No | boolean | Leave this out: the template's type (marketing or transactional, set on the template) decides how the email is sent. A value that disagrees with the template is refused at validate and publish; one that agrees is accepted and changes nothing. |
| `to` | No | text | Fixed recipient for ops/internal flows. Omit to email the enrolled contact. |
| `subject` | No | text | Subject override; the template's subject otherwise. |
| `variables` | No | object | Template variable → value: a run-context path string, { path, fallback? }, or { value }. E.g. { plan: "contact.plan", cart_url: { path: "event.data.cart_url", fallback: "https://…" } }. first_name and last_name come from the contact and take only a fallback, used when the contact has none: { first_name: { path: "contact.first_name", fallback: "there" } }. |
| `onMissingVariables` | No | `fail`, `skip` | "skip" = skip this email when a required template value is missing (default "fail" → onError). |
| `onError` | No | `fail_run`, `skip_node`, `pause_run` | pause_run (default: the run fails; 3 in a row at this block pause the automation) | fail_run (never pause) | skip_node. Overrides the automation policy for this block. |

Paths out: `next`. Later blocks read `steps.<id>.output.channel`, `steps.<id>.output.status`, `steps.<id>.output.skip_reason`, `steps.<id>.output.address`, `steps.<id>.output.handle_id`, `steps.<id>.output.message_id`, `steps.<id>.output.provider_message_id`, `steps.<id>.output.marketing`.

### Send SMS

`action.sms.send`. Sends a text message to the run's contact through the full SMS send path (consent, suppression, sender reach, review). Marketing needs prior consent on record; without it the contact is skipped.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `templateId` | No | text | PUBLISHED SMS template id. Use this OR `body`. |
| `body` | No | text | Inline message text with {{variables}} (same vocabulary as templates). Use this OR `templateId`. |
| `senderId` | No | text | Sender to send from (a live number / Sender ID). Omit to let the server pick one that reaches the contact's country. |
| `type` | No | `MARKETING`, `TRANSACTIONAL` | "MARKETING" (default) needs the contact's prior express consent: no consent = skipped. "TRANSACTIONAL" for receipts / OTP / account notices: ignores marketing consent, still honours STOP and suppression. |
| `variables` | No | object | Template/body variable → value: a run-context path string, { path, fallback? }, or { value }. |
| `onMissingVariables` | No | `fail`, `skip` | "skip" = skip this SMS when a required variable is missing (default "fail" → onError). |
| `onError` | No | `fail_run`, `skip_node`, `pause_run` | pause_run (default: the run fails; 3 in a row at this block pause the automation) | fail_run (never pause) | skip_node. Overrides the automation policy for this block. |

Paths out: `next`. Later blocks read `steps.<id>.output.channel`, `steps.<id>.output.status`, `steps.<id>.output.skip_reason`, `steps.<id>.output.address`, `steps.<id>.output.handle_id`, `steps.<id>.output.message_id`, `steps.<id>.output.marketing`.

### Update contact

`action.contact.update`. Sets or clears contact fields (built-in and custom).

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `set` | Yes | object | Field key → literal value, { path: "event.data.plan" } to read run data, or null to clear. Custom values are coerced to the field's registry type. `email` cannot be changed. `unsubscribed: false` is not applied to a contact who unsubscribed themselves (link, preference page, spam report) unless their own reply, text or preference-page subscribe started the run (output opt_out_kept). |
| `onError` | No | `fail_run`, `skip_node`, `pause_run` | pause_run (default: the run fails; 3 in a row at this block pause the automation) | fail_run (never pause) | skip_node. Overrides the automation policy for this block. |

Paths out: `next`. Later blocks read `steps.<id>.output.changed_fields`, `steps.<id>.output.opt_out_kept`, `steps.<id>.output.skip_reason`.

### Change topic subscription

`action.contact.topic`. Subscribes or unsubscribes the contact from a topic.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `topicId` | Yes | text | Topic id (top_… or bare). |
| `op` | Yes | `subscribe`, `unsubscribe` | Idempotent: no-op when already in that state. A subscribe never undoes the contact's own opt-out (unsubscribe link, preference page) unless their own reply, text or preference-page subscribe started the run: the step is skipped (contact_opted_out). An opt-out set over the API, an import or the dashboard is reversed. |
| `onError` | No | `fail_run`, `skip_node`, `pause_run` | pause_run (default: the run fails; 3 in a row at this block pause the automation) | fail_run (never pause) | skip_node. Overrides the automation policy for this block. |

Paths out: `next`. Later blocks read `steps.<id>.output.topic_id`, `steps.<id>.output.op`, `steps.<id>.output.changed`, `steps.<id>.output.skip_reason`.

### Add/remove from segment

`action.segment.modify`. Adds or removes the contact from a static segment.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `segmentId` | Yes | text | STATIC segment id (seg_… or bare); dynamic segments can't be edited. |
| `op` | Yes | `add`, `remove` | Idempotent: no-op when membership already matches. |
| `onError` | No | `fail_run`, `skip_node`, `pause_run` | pause_run (default: the run fails; 3 in a row at this block pause the automation) | fail_run (never pause) | skip_node. Overrides the automation policy for this block. |

Paths out: `next`. Later blocks read `steps.<id>.output.segment_id`, `steps.<id>.output.op`, `steps.<id>.output.changed`.

### Call webhook

`action.webhook.send`. Sends a signed POST with the run context to your URL (SSRF-guarded, retried).

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `url` | Yes | text | https URL to POST the run context to (private/internal addresses are blocked). |
| `payload` | No | object | Static key/values merged into the payload's `data`. |
| `secret` | No | text | Signing secret: requests are signed like Unitpost webhooks (svix-id, svix-timestamp, svix-signature), so your SDK's verifyWebhook checks them with it. Left out on a new block, or "generate", Unitpost generates one (whsec_…) and the write answers it once in `generated_secrets`; your own must be whsec_ or 22+ base64url characters. null = unsigned. Write-only: reads show a placeholder; send it back (or leave the key out) to keep the stored secret. `payload` and `url` are shown on reads: never put a credential in them. |
| `onError` | No | `fail_run`, `skip_node`, `pause_run` | pause_run (default: the run fails; 3 in a row at this block pause the automation) | fail_run (never pause) | skip_node. Overrides the automation policy for this block. |

Paths out: `next`. Later blocks read `steps.<id>.output.response_code`.

### Wait

`flow.wait.duration`. Pauses the run for a fixed duration (hours, days, weeks).

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `duration` | Yes | text | ISO-8601 duration: PT30M, PT4H, P2D, P1W. |
| `alignTo` | No | object | Continue at a local time after the wait: { timeOfDay: "09:00", timezone: "Europe/Berlin" }. |

Paths out: `next`. Later blocks read `steps.<id>.output.waited`, `steps.<id>.output.skipped_by_user`.

### Wait until

`flow.wait.until`. Pauses until a day and time comes round: the next Monday 09:00, the next 18:00, one fixed date, or a date of the contact or the trigger event moved by an offset (3 days before trial_ends_at, 24 hours before appointment_at), in a set time zone or each contact's own. A contact date that changes while the run waits re-times the wait.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `weekday` | No | unknown | Day of the week: "monday" … "sunday" (or 0 = Sunday … 6). Omit for the next day the time comes round. Not with `date`. |
| `date` | No | text | One fixed day, "YYYY-MM-DD". Must be in the future when published; a run reaching the block after it continues right away. Not with `weekday`. |
| `relativeTo` | No | object | Wait until a date of the contact or the trigger event instead: { path: "contact.trial_ends_at", offset: "P3D", direction: "before" }. Not with `weekday` or `date`. |
| `timeOfDay` | No | text | Local time the run continues at, 24-hour "HH:mm". Required, except with `relativeTo` (absent = the exact moment of the date and offset). |
| `onMissingDate` | No | `exit`, `continue`, `branch` | With `relativeTo`: when the date is missing, empty or not an ISO date. "exit" (default) ends the run, "continue" goes on now, "branch" takes the `no_date` handle. |
| `onPassed` | No | `continue`, `exit`, `branch` | With `relativeTo`: when the moment is already behind the run (or a change moves it behind). "continue" (default) goes on now, "exit" ends the run, "branch" takes the `passed` handle. |
| `timezone` | Yes | text | IANA zone ("America/New_York"), or "contact" for each contact's own `timezone` field (falls back to `fallbackTimezone`, else UTC). |
| `fallbackTimezone` | No | text | With timezone "contact": the zone for contacts without a valid `timezone` field (default UTC). |

Paths out: `next`. Later blocks read `steps.<id>.output.waited`, `steps.<id>.output.passed`, `steps.<id>.output.date_status`, `steps.<id>.output.date`, `steps.<id>.output.skipped_by_user`. Shape: `{ weekday?: "monday", timeOfDay: "09:00", timezone: "Europe/Berlin" | "contact", fallbackTimezone?: "UTC" } or { date: "2026-12-24", timeOfDay: "18:00", timezone: "America/New_York" } or { relativeTo: { path: "contact.trial_ends_at", offset: "P3D", direction: "before" }, timezone: "contact" }`

### Wait for event

`flow.wait.event`. Pauses until a matching event arrives for this contact, or the timeout elapses.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `eventType` | Yes | text | Platform event (email.opened, email.clicked, …) or your event name (order.completed). Only the run's own contact's events resume it. |
| `filter` | No | object | Optional condition on the arriving event (contact.*, handle.*, event.* scopes only). |
| `timeout` | Yes | text | Give up after this long and leave via the `timeout` handle (ISO-8601, e.g. P1D). |
| `ignoreAutomaticMail` | No | boolean | For email.received: an out-of-office reply, bounce or bulk list mail doesn't end the wait (default true). |

Paths out: `event`, `timeout`. Later blocks read `steps.<id>.output.resumed_by`, `steps.<id>.output.skipped_by_user`, `steps.<id>.output.event_id`, `steps.<id>.output.event.id`, `steps.<id>.output.event.type`, `steps.<id>.output.event.source`, `steps.<id>.output.event.created_at`.

### If / else

`flow.branch.condition`. Routes the run by a condition on contact, event, or step data.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `filter` | Yes | object | Condition deciding yes/no. Fields: contact.*, handle.<channel>.*, event.*, steps.<upstreamId>.output.*, run.*. |

Paths out: `yes`, `no`. Later blocks read `steps.<id>.output.matched`.

### Multi-branch

`flow.branch.multi`. Routes down the first branch whose condition matches, else the fallback.

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `branches` | Yes | array | Ordered, first match wins; handles are b1..bN plus `else`. Each: { label?, filter }. |

Paths out: `b1`, `…`, `bN`, `else`. Later blocks read `steps.<id>.output.branch`, `steps.<id>.output.label`.

### Exit

`flow.exit`. Ends the run here as Completed, the end of this path (an optional reason names which end it reached).

| Field | Required | Values | Meaning |
| --- | --- | --- | --- |
| `reason` | No | text | Shown in the run ledger as why the run ended. |

Ends the run.

Triggers are on Automation triggers (/guides/automations-triggers).

## Related

- [Automation data and variables](https://www.unitpost.com/guides/automations-data): The data paths conditions and template variables read in an automation: the contact, the trigger event, earlier blocks' outputs and the run itself.
- [Automation safety and limits](https://www.unitpost.com/guides/automations-safety): The guards every automation runs with: loop guards, frequency caps, re-entry, wait and run limits, live-run ceilings and the permissions each step needs.
- [Test and publish an automation](https://www.unitpost.com/guides/automations-testing): Validate, read readiness, dry-run for a contact, preview an enrollment, publish, and what a new version does to people mid-journey.
