uSend Docs
Automations

Automations

Send emails and update contacts automatically when something happens.

An automation starts when an event happens to a contact, then runs a series of steps for that contact: wait, check a condition, send an email, change the contact.

Use them for welcome series, abandoned-cart reminders, trial follow-ups and re-engagement.

Note

Automation emails are marketing mail. They follow the same rules as broadcasts: your organization must be out of the sandbox, broadcasts must be on, and the email counts against your quota. Every email carries an unsubscribe link and the List-Unsubscribe headers.

How a run works

  1. An event reaches usend (from your app with POST /events/send, or a platform event such as a new contact).
  2. Every enabled automation that starts on that event starts a run for that contact.
  3. The run moves through the steps. Delays and waits pause it; usend picks it up again on time.
  4. The run ends when no step follows, or it fails or is cancelled.

Each step runs once per run. You can watch every run and step on the automation's page in the dashboard (Automations), or with GET /automations/{id}/runs.

Steps

See Steps for the full list: delay, condition, wait for event, send email, add to segment, update contact and delete contact.

Statuses

StatusMeaning
draftBeing built. Never starts runs.
enabledStarts a run for each matching event.
disabledStarts nothing new. Runs already started continue.
stoppedStopped with POST /automations/{id}/stop: active runs are cancelled. Enable it again to resume.

Editing the steps of an enabled automation affects new runs only. A run keeps the steps it started with.

What is skipped, and what fails a run

  • A contact who is unsubscribed, suppressed, or opted out of the email's topic is skipped: the step is marked skipped and the run goes on.
  • If your organization is suspended, restricted, or over its quota, the run fails with the reason.
  • If a template, segment or topic was deleted, the run fails and says which.

Limits

To stop an automation from feeding itself, one automation starts at most 5 runs per contact per 24 hours and 5,000 runs per hour. Triggers beyond that are ignored. An automation can have up to 50 steps and cannot loop back on itself.

Create one

Shell
curl -X POST https://api.usend.et/automations \
  -H "Authorization: Bearer us_123456789" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome",
    "status": "enabled",
    "steps": [
      { "key": "start", "type": "trigger", "config": { "event_name": "usend:contact.created" } },
      { "key": "pause", "type": "delay", "config": { "duration": "1 hour" } },
      { "key": "hello", "type": "send_email", "config": {
          "from": "Acme <[email protected]>", "subject": "Welcome, {{{FIRST_NAME|friend}}}",
          "html": "<p>Glad you are here.</p><p><a href=\"{{{UNSUBSCRIBE_URL}}}\">Unsubscribe</a></p>" } }
    ],
    "connections": [
      { "from": "start", "to": "pause" },
      { "from": "pause", "to": "hello" }
    ]
  }'