Automation examples

Complete, tested automations: welcome series, abandoned cart, inbound auto-reply, SMS reminder, re-engagement, plus the blueprints and their params.

Each example is a complete POST /v1/automations body. Our tests run every one through the same validator publish uses. Swap in your own template, topic and segment ids and a sender on a verified domain, then validate and publish.

Welcome series

Ask: "Send new signups our welcome email right away and getting-started tips two days later."

  • A new contact starts it once, ever (the Contact created default).
  • Both emails are marketing under a topic, so the unsubscribe and the frequency cap apply.
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Welcome series",
    "description": "Welcome now, tips after 2 days.",
    "definition": {
      "schemaVersion": 1,
      "trigger": {
        "id": "start",
        "kind": "trigger.contact.created",
        "config": {}
      },
      "nodes": [
        {
          "id": "welcome",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_welcome",
            "from": "Acme <hello@mail.acme.com>",
            "topicId": "top_product_news"
          }
        },
        {
          "id": "wait_2d",
          "kind": "flow.wait.duration",
          "config": {
            "duration": "P2D"
          }
        },
        {
          "id": "tips",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_getting_started",
            "from": "Acme <hello@mail.acme.com>",
            "topicId": "top_product_news"
          }
        },
        {
          "id": "done",
          "kind": "flow.exit",
          "config": {
            "reason": "Finished the welcome series"
          }
        }
      ],
      "edges": [
        {
          "id": "e1",
          "from": "start",
          "to": "welcome"
        },
        {
          "id": "e2",
          "from": "welcome",
          "to": "wait_2d"
        },
        {
          "id": "e3",
          "from": "wait_2d",
          "to": "tips"
        },
        {
          "id": "e4",
          "from": "tips",
          "to": "done"
        }
      ]
    }
  }'

Abandoned cart with a goal

Ask: "When someone leaves items in their cart, remind them after 4 hours and again the next day, but stop as soon as they order."

  • Your backend sends cart.updated and order.completed to POST /v1/events.
  • The goal ends the run the moment order.completed arrives, so nobody who bought gets a reminder.
  • Re-entry once a week: a busy shopper gets one reminder series, not one per cart change.
  • One run per person at a time (maxConcurrentRunsPerSubject: 1, the answer to readiness runs_per_person): a cart update while they're already in it starts nothing.
  • The reminder links back with event.data.cart_url, with a fallback when the event has none.
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Abandoned cart",
    "description": "Two reminders, stops when they order.",
    "definition": {
      "schemaVersion": 1,
      "trigger": {
        "id": "start",
        "kind": "trigger.event.custom",
        "config": {
          "eventName": "cart.updated"
        }
      },
      "nodes": [
        {
          "id": "wait_4h",
          "kind": "flow.wait.duration",
          "config": {
            "duration": "PT4H"
          }
        },
        {
          "id": "reminder",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_cart_reminder",
            "from": "Acme <hello@mail.acme.com>",
            "topicId": "top_shop_updates",
            "variables": {
              "cart_url": {
                "path": "event.data.cart_url",
                "fallback": "https://shop.acme.com/cart"
              }
            }
          }
        },
        {
          "id": "wait_1d",
          "kind": "flow.wait.duration",
          "config": {
            "duration": "P1D"
          }
        },
        {
          "id": "last_call",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_cart_last_call",
            "from": "Acme <hello@mail.acme.com>",
            "topicId": "top_shop_updates",
            "variables": {
              "cart_url": {
                "path": "event.data.cart_url",
                "fallback": "https://shop.acme.com/cart"
              }
            }
          }
        },
        {
          "id": "done",
          "kind": "flow.exit",
          "config": {
            "reason": "Reminders sent"
          }
        }
      ],
      "edges": [
        {
          "id": "e1",
          "from": "start",
          "to": "wait_4h"
        },
        {
          "id": "e2",
          "from": "wait_4h",
          "to": "reminder"
        },
        {
          "id": "e3",
          "from": "reminder",
          "to": "wait_1d"
        },
        {
          "id": "e4",
          "from": "wait_1d",
          "to": "last_call"
        },
        {
          "id": "e5",
          "from": "last_call",
          "to": "done"
        }
      ]
    },
    "policy": {
      "reEntry": "once_per_interval",
      "reEntryInterval": "P7D",
      "maxConcurrentRunsPerSubject": 1,
      "goal": {
        "eventType": "order.completed",
        "window": "P2D"
      }
    }
  }'

Auto-reply to inbound email

Ask: "When a customer emails us, reply that we got their message and will answer within a day."

  • Starts on every email your domains receive, replies to your campaigns included: a trigger can't filter on the address it was sent to yet, so use it where people only write to you.
  • The filter contact.email is set lets in only senders who are already contacts; anyone else doesn't start a run.
  • Out-of-office replies, bounces and bulk mail are ignored (ignoreAutomaticMail, on by default), our reply carries Auto-Submitted, and the automation never starts from its own sends, so two auto-responders can't mail each other forever.
  • Re-entry once a day: one auto-reply per sender per day, however many emails they send. Use a transactional template, because the person wrote in (the template's type decides).
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Support auto-reply",
    "description": "Acknowledge mail from contacts, once a day per sender.",
    "definition": {
      "schemaVersion": 1,
      "trigger": {
        "id": "start",
        "kind": "trigger.email.event",
        "config": {
          "events": [
            "received"
          ],
          "ignoreAutomaticMail": true,
          "filter": {
            "match": "all",
            "conditions": [
              {
                "field": "contact.email",
                "operator": "is_set"
              }
            ]
          }
        }
      },
      "nodes": [
        {
          "id": "ack",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_support_ack",
            "from": "Acme Support <support@mail.acme.com>",
            "variables": {
              "their_message": {
                "path": "event.data.snippet",
                "fallback": "your message"
              }
            }
          }
        },
        {
          "id": "done",
          "kind": "flow.exit",
          "config": {
            "reason": "Acknowledged"
          }
        }
      ],
      "edges": [
        {
          "id": "e1",
          "from": "start",
          "to": "ack"
        },
        {
          "id": "e2",
          "from": "ack",
          "to": "done"
        }
      ]
    },
    "policy": {
      "reEntry": "once_per_interval",
      "reEntryInterval": "PT24H"
    }
  }'

SMS reminder at a sensible hour

Ask: "When an appointment is booked, text the customer a reminder at the next 10am in their time zone."

  • A Wait until block sends at the next 10:00 in each contact's own time zone (their timezone field, else the fallback): the same day for a booking made before 10, else the next morning.
  • A reminder about something they booked is transactional, so it isn't held for quiet hours: the Wait until is what keeps it out of the night. Marketing texts also wait for the recipient's local quiet hours.
  • {{appointment_time}} comes from the event payload and {{first_name}} from the contact, each with a fallback, so nobody gets an empty name.
  • Each booking starts its own run, up to 3 at once per person (maxConcurrentRunsPerSubject: 3, the answer to readiness runs_per_person), so a second booking gets its own reminder.
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Appointment reminder",
    "description": "Text a reminder at the next 10:00 local time.",
    "definition": {
      "schemaVersion": 1,
      "trigger": {
        "id": "start",
        "kind": "trigger.event.custom",
        "config": {
          "eventName": "appointment.booked"
        }
      },
      "nodes": [
        {
          "id": "at_ten",
          "kind": "flow.wait.until",
          "config": {
            "timeOfDay": "10:00",
            "timezone": "contact",
            "fallbackTimezone": "America/New_York"
          }
        },
        {
          "id": "text",
          "kind": "action.sms.send",
          "config": {
            "type": "TRANSACTIONAL",
            "body": "Hi {{first_name}}, a reminder from Acme: your appointment is at {{appointment_time}}. Reply STOP to opt out.",
            "variables": {
              "first_name": {
                "path": "contact.first_name",
                "fallback": "there"
              },
              "appointment_time": {
                "path": "event.data.starts_at_local",
                "fallback": "your booked time"
              }
            }
          }
        },
        {
          "id": "done",
          "kind": "flow.exit",
          "config": {}
        }
      ],
      "edges": [
        {
          "id": "e1",
          "from": "start",
          "to": "at_ten"
        },
        {
          "id": "e2",
          "from": "at_ten",
          "to": "text"
        },
        {
          "id": "e3",
          "from": "text",
          "to": "done"
        }
      ]
    },
    "policy": {
      "maxConcurrentRunsPerSubject": 3
    }
  }'

Trial ending reminder from a contact date

Ask: "Email trial users 3 days before their trial ends (our app keeps trial_ends_at on the contact), at 9am their time, unless they upgrade first."

  • Wait until with relativeTo ends 3 days before each contact's trial_ends_at, at 09:00 in their own time zone. If the trial is extended while they wait, the wait moves with it.
  • No trial_ends_at on the contact: the run ends without sending (onMissingDate: exit). Signed up with less than 3 days left: the reminder goes right away (onPassed: continue).
  • The exit rule ends the run the moment plan is set to something other than trial, even mid-wait, so nobody who upgraded gets the reminder.
  • Use a transactional template for an account notice like this one (the template's type decides; a marketing one would skip people who unsubscribed).
  • One run per person (maxConcurrentRunsPerSubject: 1, the answer to readiness runs_per_person): a repeated trial.started while they wait starts nothing.
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Trial ending reminder",
    "description": "3 days before trial_ends_at, at 09:00 their time.",
    "definition": {
      "schemaVersion": 1,
      "trigger": {
        "id": "start",
        "kind": "trigger.event.custom",
        "config": {
          "eventName": "trial.started"
        }
      },
      "nodes": [
        {
          "id": "three_days_before",
          "kind": "flow.wait.until",
          "config": {
            "relativeTo": {
              "path": "contact.trial_ends_at",
              "offset": "P3D",
              "direction": "before"
            },
            "timeOfDay": "09:00",
            "timezone": "contact",
            "fallbackTimezone": "UTC",
            "onMissingDate": "exit",
            "onPassed": "continue"
          }
        },
        {
          "id": "reminder",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_trial_ending",
            "from": "Acme <hello@mail.acme.com>"
          }
        },
        {
          "id": "done",
          "kind": "flow.exit",
          "config": {}
        }
      ],
      "edges": [
        {
          "id": "e1",
          "from": "start",
          "to": "three_days_before"
        },
        {
          "id": "e2",
          "from": "three_days_before",
          "to": "reminder"
        },
        {
          "id": "e3",
          "from": "reminder",
          "to": "done"
        }
      ]
    },
    "policy": {
      "maxConcurrentRunsPerSubject": 1,
      "exitConditions": {
        "match": "all",
        "conditions": [
          {
            "field": "contact.plan",
            "operator": "is_set"
          },
          {
            "field": "contact.plan",
            "operator": "neq",
            "value": "trial"
          }
        ]
      }
    }
  }'

Re-engagement with a frequency cap

Ask: "Win back the people our nightly job adds to our Win-back list: one email, and if they don't click within a week, a last-chance email. Skip anyone another journey already emailed that day."

  • A click within 7 days marks them active and ends the run; no click sends the last-chance email.
  • Joined segment fires only for a static segment (people added by hand, the API or an automation step), like this list. For a rule such as "inactive 90 days", trigger on Contact updated with a filter instead.
  • maxSendsPerSubjectPerDay: 1: these emails skip for anyone who already got a marketing email from any automation in the last 24 hours (the cap counts every automation; the default is 3).
  • Re-entry at most every 90 days, so someone added to the list again soon isn't mailed again.
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Win back inactive",
    "description": "One nudge, a last chance after a week without a click.",
    "definition": {
      "schemaVersion": 1,
      "trigger": {
        "id": "start",
        "kind": "trigger.segment.joined",
        "config": {
          "segmentId": "seg_win_back"
        }
      },
      "nodes": [
        {
          "id": "miss_you",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_we_miss_you",
            "from": "Acme <hello@mail.acme.com>",
            "topicId": "top_product_news"
          }
        },
        {
          "id": "clicked",
          "kind": "flow.wait.event",
          "config": {
            "eventType": "email.clicked",
            "timeout": "P7D"
          }
        },
        {
          "id": "mark_active",
          "kind": "action.contact.update",
          "config": {
            "set": {
              "lifecycle_stage": "active"
            }
          }
        },
        {
          "id": "last_chance",
          "kind": "action.email.send",
          "config": {
            "templateId": "tmpl_last_chance",
            "from": "Acme <hello@mail.acme.com>",
            "topicId": "top_product_news"
          }
        },
        {
          "id": "came_back",
          "kind": "flow.exit",
          "config": {
            "reason": "Clicked"
          }
        },
        {
          "id": "done",
          "kind": "flow.exit",
          "config": {
            "reason": "Last chance sent"
          }
        }
      ],
      "edges": [
        {
          "id": "e1",
          "from": "start",
          "to": "miss_you"
        },
        {
          "id": "e2",
          "from": "miss_you",
          "to": "clicked"
        },
        {
          "id": "e3",
          "from": "clicked",
          "to": "mark_active",
          "fromHandle": "event"
        },
        {
          "id": "e4",
          "from": "mark_active",
          "to": "came_back"
        },
        {
          "id": "e5",
          "from": "clicked",
          "to": "last_chance",
          "fromHandle": "timeout"
        },
        {
          "id": "e6",
          "from": "last_chance",
          "to": "done"
        }
      ]
    },
    "policy": {
      "reEntry": "once_per_interval",
      "reEntryInterval": "P90D",
      "maxSendsPerSubjectPerDay": 1
    }
  }'

Start from a blueprint

A blueprint builds a common journey from a few params. Pass blueprint and blueprint_params instead of a definition; params with a default can be left out. Add allow_missing_params: true to save the draft with the params you don't have yet left empty; validate lists what's left.

BlueprintWhat it doesParams
welcome-seriesThree-email new-contact drip (day 0 / 1 / 4). Consider a frequency cap when other journeys overlap.from, template_welcome, template_story, template_offer, wait_1 (default P1D), wait_2 (default P3D)
welcome-series-with-sms-nudgeWelcome email, a follow-up a day later, then a text to anyone who didn't open the follow-up within 3 days. Marketing texts go only to contacts with SMS consent (the rest are skipped); needs SMS on a plan that includes it.from, template_welcome, template_followup, wait_1 (default P1D), timeout (default P3D), sms_body (default Hi {{first_name}}, we sent you a welcome email with everything you need to get started. Check your inbox!), sms_type (default MARKETING)
weekly-digestWelcomes a new topic subscriber right away, then sends the digest on the next digest day (default Monday 09:00 in the contact's own time zone, UTC when they have none). Later issues go out as your regular campaigns.from, topic, template_welcome, template_digest, weekday (default monday), time (default 09:00), timezone (default contact), fallback_timezone (default UTC)
abandoned-cartNudges when the order never completes (24h after the last cart update, with the latest cart). Needs a backend cart.updated event + an order.completed event.from, event (default cart.updated), completion_event (default order.completed), template_reminder, timeout (default PT24H)
post-purchase-reviewAsks for a review a week after purchase.from, event (default order.completed), template_review, wait (default P7D)
winbackRe-engages dormant contacts; offer only goes to the unopened, and a purchase ends it. Your backend or an API call fills the dormant segment. Pair with a frequency cap.from, segment, template_winback, template_offer, timeout (default P3D), goal_event (default order.completed)
winback-after-purchaseEmails customers who haven't ordered for 90 days, then sends an offer two weeks later. Every new order starts the clock again.from, event (default order.completed), template_miss, template_offer, wait (default P90D)
trial-onboardingDay 0/1/3 education for new trials (filters to plan = trial); anyone whose plan changes leaves.from, template_day0, template_day1, template_day3, plan (default trial), wait_1 (default P1D), wait_2 (default P2D)
trial-expiryConverts trials still active at day 14; everyone else exits silently.from, template_convert, plan (default trial), wait (default P14D)
newsletter-welcomeGreets new topic subscribers, then shares the best-of.from, topic, template_welcome, template_best, wait (default P2D)
reengagementOpens go back to active; the silent get moved to digest.from, segment, template_miss, topic_digest, timeout (default P7D), active_stage (default active)
nps-surveyAsks for feedback a day after renewal; stops nagging on answer.from, event (default subscription.renewed), answer_event (default survey.answered), template_nps, wait (default P1D), timeout (default P7D)
sunset-cleanupMarks unsubscribers churned and removes them from the segment.topic, segment, churned_stage (default churned)
activation-nudgeNudges new users who haven't taken the first key step (your activation event) within two days of signing up; anyone who takes it gets nothing.from, event (default user.signed_up), activation_event (default project.created), template_nudge, timeout (default P2D)
trial-ending-reminderReminds trial users three days before their trial ends (09:00 in their time zone); upgrading ends it. Reads the end date from a date contact field.from, event (default trial.started), upgrade_event (default subscription.started), template_reminder, date_field (default trial_ends_at), offset (default P3D)
payment-failedTells customers their payment failed, then sends a final notice three days later unless they've paid. Pick transactional templates, so the notices reach people who unsubscribed from marketing.from, event (default invoice.payment_failed), paid_event (default invoice.paid), template_failed, template_final, wait (default P3D)
renewal-reminderReminds customers a week before their subscription renews (10:00 in their time zone). Starts when the renewal date on the contact is set or changes.from, date_field (default renews_at), template_reminder, offset (default P7D)
usage-limit-warningEmails customers when they near their plan's limit, and a different email once they reach it. Your event carries the percent used.from, event (default usage.threshold_reached), template_warning, template_limit
lead-nurtureSends new topic subscribers a welcome now, then two more emails a week apart on your chosen day (default Tuesday 09:00 in the contact's time zone).from, topic, template_welcome, template_followup, template_offer, weekday (default tuesday), time (default 09:00), timezone (default contact), fallback_timezone (default UTC)
paid-customer-welcomeWelcomes customers when their plan field changes to your paid plan, then sends tips two days later.from, paid_plan (default pro), template_welcome, template_tips, wait (default P2D)
cancellation-winbackAsks customers who cancel why they left, then sends an offer 30 days later unless they've come back.from, event (default subscription.canceled), goal_event (default subscription.started), template_feedback, template_offer, wait (default P30D)
team-alertEmails your team (a fixed address such as sales@) when your backend sends an event, like a demo request. The contact gets nothing.from, event (default demo.requested), template_alert, to
appointment-reminderEmails a reminder 24 hours before a booked appointment. Your event carries the start time and a booking id; cancelling that booking stops its reminder.from, event (default appointment.booked), cancel_event (default appointment.canceled), template_reminder, start_key (default starts_at), id_key (default appointment_id), offset (default PT24H)
appointment-reminder-with-smsEmails a reminder 24 hours before a booked appointment and texts one 2 hours before; cancelling the booking stops them. Pick a transactional email template, so the reminder reaches people who unsubscribed from marketing.from, event (default appointment.booked), cancel_event (default appointment.canceled), template_reminder, sms_body (default Reminder: your appointment starts in 2 hours. Reply STOP to opt out.), start_key (default starts_at), id_key (default appointment_id)
sms-keyword-replyTexts back an answer when a contact texts a keyword to your number (default HOURS). The reply is transactional and doesn't sign them up for marketing texts.keyword (default HOURS), sms_body (default We're open Monday to Friday, 9:00 to 17:00. Reply STOP to opt out.)
email-auto-replyReplies to contacts who email your receiving domain that you got their message, at most once a day per sender. Out-of-office and bulk mail are ignored.from, template_reply

Search docs and guides

Search the docs and product guides.