Marketing
Automations
Build multi-step email workflows that react to what your contacts do — welcome series, onboarding drips, and lifecycle flows that run themselves.
An automation is a trigger plus an ordered set of steps. When something happens — a contact subscribes, or you fire a named event — Deckle enrolls the contact and walks them forward through the flow: sending email, waiting, branching, and updating their record along the way.
What is an automation#
Each automation has a single trigger and a list of steps that form a forward flow (a DAG — steps always point onward, never back). A contact enters at the trigger and moves from one step to the next until the flow ends or a branch sends them down a different path.
Steps run in order. A delay or wait step parks the contact until its time or event arrives, then the flow resumes exactly where it left off. Every enrolled contact keeps its own position, so thousands of people can be at different points in the same automation at once.
Contacts are the unit of enrollment
Automations operate on contacts, keyed by email. A step can send a template, wait, branch on a field, or change the contact’s record — always for the one contact moving through the flow.Triggers#
A trigger decides who enters the automation and when. There are two kinds.
| Trigger | Fires when |
|---|---|
contact.subscribed | A contact becomes subscribed — for example a newly created subscribed contact, which auto-enrolls in your live welcome flows. |
event | A custom event you fire by name (such as user.signed_up or order.completed) matches the automation’s configured event. |
For an event trigger, name the event the automation should listen for. Any event you send with that name enrolls the matching contact. The same event stream can also wake a wait step mid-flow — see below.
Step types#
Steps are the building blocks of the flow. Each step has a type that determines what it does and where the contact goes next.
| Type | What it does |
|---|---|
email | Sends a template to the contact. Optionally override the subject line for this step. |
delay | Waits a fixed amount of time before continuing — delayMinutes from 1 to 525600 (one year). |
wait | Pauses until a named event arrives (waitEvent) or a timeout elapses (waitTimeoutMinutes, 1 to 36000). Whichever comes first resumes the flow. |
condition / branch | An if/else test on a field, op, and value. A match routes to nextTrue; otherwise to nextFalse. |
action | Changes the contact record: unsubscribe, update-field, add-tag, or remove-tag. |
Branches keep the flow moving forward
Acondition step splits the path in two but never loops back. Point nextTrue and nextFalse at the steps each side should continue to, and leave one unset to end that branch.Build it visually#
Most automations start in the dashboard. Open Automations in the top nav to design a flow on a canvas — no code required.
Create an automation
Pick a trigger
contact.subscribed or an event trigger and, for events, type the event name to listen for.Add steps
email, delay, wait, condition, and action steps and connect them into the order you want. Branch lanes show the true and false paths side by side.Go live
draft to live to start enrolling contacts. Draft flows never enroll anyone.Via the API#
You can also define an automation programmatically. Pass a trigger and an ordered array of steps to automations.create. The example below sends a welcome email, waits three days, branches on whether the contact has opened, and tags them accordingly.
import { Deckle } from "@deckle/sdk";
const deckle = new Deckle(process.env.DECKLE_API_KEY!);
const automation = await deckle.automations.create({
name: "Welcome series",
trigger: { type: "contact.subscribed" },
steps: [
{
id: "welcome",
type: "email",
template: "tmpl_welcome",
subjectOverride: "Welcome to Acme 👋",
},
{ id: "wait_3d", type: "delay", delayMinutes: 4320 },
{
id: "check_opened",
type: "condition",
field: "opened",
op: "eq",
value: true,
nextTrue: "tag_engaged",
nextFalse: "nudge",
},
{ id: "tag_engaged", type: "action", action: "add-tag", value: "engaged" },
{ id: "nudge", type: "email", template: "tmpl_nudge" },
],
});A new automation is created as a draft. Manage it with automations.list, automations.get, automations.update, and automations.delete, or see the full API reference.
Going live#
An automation is either draft or live. Draft flows are editable but inert — no one is enrolled and no steps run. Setting the status to live starts enrolling matching contacts.
- Draft — the build state. Change the trigger and steps freely; nothing fires.
- Live — the automation enrolls contacts and, on going live, resumes any enrollments that were paused while it was a draft, so contacts pick up where they left off.
Test before you flip it live
Once live, real contacts start moving through the flow and receiving email. Preview each template and double-check delays and branches before changing the status.