# Flows

> Build WhatsApp chatbots and automations visually: triggers, questions, buttons, conditions, delays and AI.

Source: https://zyptos.com/docs/flows

## Create a flow

1. Open `Flows` and click `New flow`. Start blank or from a template: welcome message, lead capture, AI support, opt-in or order update.
2. Pick the trigger in the first card, then add steps from the left panel (on a phone, tap the + button). Drag from a step's output dot to the next step to connect them.
3. Click a step to edit it. Problems, like an empty message or a missing connection, are listed at the top of the builder.
4. Save with `Save` or Ctrl/Cmd + S, then `Turn on`. Pausing a flow stops it from starting and ends runs that are waiting.

## Triggers

| Trigger | Starts when |
| --- | --- |
| Keyword | An incoming message is, starts with or contains one of your keywords (not case sensitive). |
| New contact | Someone messages your number for the first time. |
| Button reply | A customer taps a quick-reply or list button, matched by button text or ID (or any button). |
| Opt-in | A customer sends START, SUBSCRIBE or UNSTOP. They are opted back in to templates first. |
| Webhook | Your system calls the flow's private URL with a phone number (see below). |

Only one flow runs per contact at a time. If several active flows match, the most specific trigger wins (an exact keyword beats “contains”, which beats “new contact”). A contact who replies STOP is never started on a flow. Messages that no flow handles go to the AI agent if it's on, and always to the inbox.

## Steps

| Step | What it does |
| --- | --- |
| Send text | A text message with variables. |
| Send template | An approved template with its variables. Works outside the 24-hour window. |
| Send media | An image, video, document or audio file from a public link, with a caption. |
| Reply buttons | Up to 3 quick-reply buttons. Each button gets its own path, plus one for any other answer. |
| List menu | Up to 10 rows in a menu. Each row gets its own path. |
| Ask a question | Waits for the reply, checks it (text, number, email or phone) and saves it to the contact's name, email, a custom field or a flow variable. Asks again up to twice when the answer isn't valid. |
| Condition | Yes/No branch on a variable, contact field, tag or the last message (equals, contains, starts with, greater/less than, is set). |
| Wait | Waits minutes, hours or days (up to 30 days), then continues. |
| Tag contact | Adds or removes contact tags, for campaigns and filters. |
| Assign to teammate | Stops the AI in the chat, assigns it to a teammate (or the whole team) and notifies them. |
| AI reply | Answers the last message from your AI knowledge base. Goes down the "Needs a person" path when it can't answer. |
| HTTP request | Calls your API (GET, POST, PUT, PATCH or DELETE) and saves the JSON response to a variable. Success and error paths. |
| End | Finishes the run. |

> **Waiting for replies** A flow waits up to 24 hours for an answer to a question, button or list. After that the run expires and the next message is handled normally.

## Variables

Use these in any text, URL or header. Unknown variables become empty.

| Variable | Value |
| --- | --- |
| `{{contact.name}}` | Contact name, or their WhatsApp profile name |
| `{{contact.first_name}}` | First word of the name |
| `{{contact.phone}}` | Number with country code |
| `{{contact.email}}` | Saved email |
| `{{contact.city}}` | Any custom contact field, by its key |
| `{{message}}` | The customer's last message |
| `{{vars.budget}}` | A flow variable saved by a question, the webhook or an HTTP request (dots read nested JSON, e.g. vars.order.total) |

## Webhook trigger

Flows with a webhook trigger get a private URL, shown in the trigger card. Send a POST with JSON to start the flow for a number. Keep the URL secret; create a new one from the trigger card if it leaks.

Start a flow:

```bash
curl -X POST https://zyptos.com/webhooks/flows/<token> \
  -H "Content-Type: application/json" \
  -d '{"phone": "919812345678", "name": "Asha", "variables": {"order_id": "A-1042", "total": "₹1,499"}}'
```

- Responds `202` with `{"ok": true, "run_id": "…", "status": "completed"}`. The contact is created if needed. Variables are available as `{{vars.order_id}}`.
- Errors: `400` for a missing or invalid phone number, `403` when the workspace's plan doesn't include flows, `404` for an unknown URL, `409` when the flow is paused or the contact has opted out, and `429` above 120 calls a minute.
- The first message to a contact outside the 24-hour window must be a template step.

## Runs and history

Each time a flow starts for a contact it creates a run. Open `Run history` from a flow to see every run, its status (running, waiting, completed, failed, stopped or expired) and a step-by-step log with what was sent and saved. You can stop a waiting run from there.

## Plans and limits

- Flows are included from the Starter plan. Each plan sets how many flows can be live at once; drafts and paused flows don't count. The meter on the Flows page shows your usage.
- If you move to a plan with fewer live flows, only the oldest ones keep running until you pause some.
- Up to 80 steps per flow and 60 steps per run, to stop accidental loops.
- AI reply steps use your plan's monthly AI replies.
