# Automation (/automation)



A workflow is a small graph. A **trigger** decides which contacts enter it, and
each contact then walks the graph one step at a time, on their own clock.

Four kinds of step exist:

| Step          | What it is                                                                                      |
| ------------- | ----------------------------------------------------------------------------------------------- |
| **Trigger**   | The event that lets a contact in. Exactly one per workflow.                                     |
| **Action**    | Something done to or for that contact — send a message, add them to a group, call your webhook. |
| **Condition** | A fork. The contact goes down the *Yes* branch or the *No* branch.                              |
| **Wait**      | A pause. The contact stops here and resumes later.                                              |

## Triggers [#triggers]

| Trigger           | Fires when                                                                                                                                                        |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `new_contact`     | A contact is created. Pick a group and it fires instead when a contact joins that group — by hand, through an import, the API, a bulk action or another workflow. |
| `contact_replied` | A contact sends you a message on WhatsApp, SMS or email.                                                                                                          |
| `no_response`     | A contact has not replied for N days after a delivered message — handed to WhatsApp, the SMS provider or the mail server, not necessarily read.                   |
| `webhook`         | Another system POSTs to this workflow's URL.                                                                                                                      |
| `schedule`        | Daily, weekly on chosen days, or monthly on a chosen date.                                                                                                        |
| `birthday`        | On a contact's birthday, or N days before it.                                                                                                                     |
| `manual`          | You pick the contacts yourself, from the workflow page.                                                                                                           |

A webhook trigger has its own URL, generated on the server when you save. Treat
it as a secret: anyone holding it, with an API key carrying the
`automation:write` scope, can enrol contacts into that workflow. Duplicating a
workflow does **not** copy the URL — the copy gets its own.

## Actions [#actions]

Messaging actions queue through the same sending pipeline your campaigns use, so
gateway limits, delays and delivery reports all behave the same way.

A contact can belong to any number of groups, or to none. The group actions
change memberships only; the contact itself is never copied or deleted:

* **Add to group** adds the contact to a group and keeps every group they are
  already in.
* **Move to group** takes the contact out of every other group and puts them in
  this one.
* **Remove from group** takes the contact out of that one group. Their other
  groups stay, and a contact left in no group is still a contact.

**Notify me** emails the workflow's owner. It cannot send to an arbitrary
address; if you need to reach another system, choose the webhook method instead.
Outbound webhooks may only target public addresses.

## Waits [#waits]

A wait does not hold a worker open. The contact is parked with a wake-up time and
resumes then, so a seven-day wait costs nothing while it runs.

Wait until a **date** or a **time of day** uses the timezone set on the step, not
the server's.

## Personalisation [#personalisation]

Placeholders use double braces, in message bodies and in webhook payloads alike:

```text
Hi {{first_name|there}}, we saved your seat.
```

`{{first_name}}`, `{{last_name}}`, `{{full_name}}`, `{{name}}`, `{{email}}`,
`{{phone}}`, `{{whatsapp}}`, `{{whatsapp_contact}}`, `{{sms_contact}}` and
`{{email_contact}}` always exist. `{{name}}` is the full name, or the contact's
number when the contact has no name. `{{phone}}` is the WhatsApp number, and the
SMS number when there is no WhatsApp number; use `{{sms_contact}}` when you need
the SMS number itself. Every custom contact attribute is available under its own
name — an attribute called `city` is `{{city}}`.

A placeholder takes the contact's value at the moment the message is queued.
Editing the contact afterwards does not change a message that is already waiting
to go out.

### Fallbacks [#fallbacks]

Write a fallback after a pipe: `{{first_name|there}}` becomes `there` when the
contact has no first name. A fallback is plain text without `{`, `}` or `|`, and
anything past 40 characters is cut off. A placeholder SendKuy does not know is
sent as written, unless it carries a fallback — then the fallback is sent.
`{{name|there}}` uses its fallback for a contact without a name, instead of the
contact's number. The single-brace form `{first_name}` is read as well, without a
fallback.

## When a step fails [#when-a-step-fails]

Each action carries its own answer to failure:

* **Carry on** — log it and move to the next step. The default.
* **Skip this step** — the same, stated explicitly.
* **Stop this contact here** — that contact's run ends; others are unaffected.

Retries are per step. A retry count of 2 means up to three attempts, spaced by
the delay you set.

## Limits [#limits]

Your plan caps three things: how many workflows you may keep, how many steps one
workflow may hold, and how many contacts may be enrolled per calendar month.
Enrolment stops when the monthly cap is reached; runs already under way finish.

## Seeing what happened [#seeing-what-happened]

**Test run** walks a workflow against one real contact and reports what each step
*would* do. Nothing is sent, nothing is changed, and no AI credits are spent.
Conditions that read an inbound message cannot be simulated — there is no
message — and they say so rather than guessing.

Once a workflow is live, its page lists every contact that entered it. Opening a
run shows each step, in order, with the gap between them and the reason for any
failure. Editing a workflow while contacts are mid-run keeps them on the steps
that still exist; contacts standing on a step you delete are stopped, with that
reason recorded on their run.

Run history is kept for 90 days.
