> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thinnest.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows

> Call, message and follow up with each contact over days — and let AI read every call and pick what happens next.

A workflow takes one contact at a time through a journey you draw: Agent calls them, AI reads the call and decides
how it went, the workflow waits, sends a WhatsApp or an SMS, calls again — whatever you connect. Each contact goes
through on their own, at their own pace, and you can see where every one of them is.

Open **Workflows** in the sidebar, then **Create workflow**:

* **Describe it, and AI builds it.** Say what should happen in a few sentences — *"When someone gets the tag new-lead,
  Riya calls them. If they're interested, send the brochure on WhatsApp and tell the sales team…"* — and AI draws the
  workflow, choosing your agents and templates by name. It is saved as a draft: look it over, fill what is marked in
  red (a template's blanks, an agent it could not tell apart), then publish.
* **Start from a ready-made one**: qualify new leads, call back missed calls, appointment reminders, payment
  reminders, document chase, win back old customers.
* **Start from a blank canvas.**

> [!NOTE]
>
> A workflow never changes an agent. A call it places is that agent's call in every way — its instructions, voice,
> steps and actions. The workflow decides only **when** to call or message and **what follows**. If you never use
> Workflows, nothing about your agents changes.

## What starts it

The **Start when** card at the left of the canvas:

| Start when | What happens |
| - | - |
| **Contacts I choose** | Press **Start** and pick a contact group, or everyone with a tag. |
| **A tag is added** | The moment a contact gets the tag, from the Contacts page or a workflow. |
| **A call ends** | After a phone or WhatsApp call — answered, missed, or cut off part-way — on any agent, or one you choose. **Which calls**: calls to your number (the default), calls Agent made (campaigns, callbacks), or both. A campaign call nobody picked up is never a missed call unless you choose it. Website and Playground conversations don't count, and neither does a call where Agent flagged the caller as spam. |
| **A form is sent** | When someone sends one of your WhatsApp forms. |
| **Your system asks** | Your CRM, website or app starts one contact through it — see [below](#start-it-from-your-system). |

Add **Only if…** to take through only the contacts who match — a tag, or their name, email, phone or language.

Contacts without a phone number are skipped, and nobody is ever in the same workflow twice at once.

## The blocks

Drag a block from the **Blocks** list onto the canvas, or click it. Draw from a block's right-hand dot to the next one.
Everything about a block is set on the block itself. **Tidy up**, at the top right of the canvas, lays every block out
left to right in the order the workflow runs, with a decision's answers top to bottom as you listed them.

| Block | What it does |
| - | - |
| **Call** | Agent calls the contact, from Agent's own number, inside the call window you set, with retries after busy, no answer or failed. Fill Agent's variables from the contact or from earlier blocks. |
| **Send WhatsApp** | Sends an approved template from your WhatsApp number, with its blanks filled. A reply reaches the agent that answers that number. |
| **Send SMS** | Sends a DLT template through your own SMS provider. |
| **AI decides** | AI reads a call and picks one of the answers you name — *Interested*, *Call back later*, *Not interested* — each with its own path. Below the confidence you set, it takes **Unsure**. |
| **Conditional** | Checks a rule — how a call went, an API's answer, a contact's details or tags — and goes **Match** or **No match**. |
| **Await** | Waits for a time (15 minutes, a day…) or until a date and time. |
| **Action** | Sends to, or reads from, your CRM or any API. Later blocks can use its answer. |
| **Update contact** | Adds or removes tags. A tag added here starts and stops sequences and workflows just as one added by hand. |
| **Tell the team** | Your owners and admins get a notification, and an email if your notification settings send one. |
| **Split test** | Sends each contact down one of two to four paths at random, by share — to find out which works better. |

When a call starts the workflow, **AI decides** and **Conditional** can read that call too: choose *The call that
started this run*. Its outcome is *answered*, *no answer*, *busy*, *voicemail* or *failed* (cut off part-way). Agent
answers every call to your number, so a caller who needs ringing back is one whose outcome is anything but
*answered* — the **Call back missed calls** starter checks exactly that.

### Filling blanks

Anywhere you fill a blank or a variable, type text or pick a value: the contact's name, phone or email, an earlier
call's **summary** or **outcome**, or an earlier action's answer.

In an **Action**, values are written safely for where they go: encoded in the address (a `+` in a phone number stays a
`+`), escaped inside a JSON body (a quote in somebody's name can't break it), and kept to one line in a header.

## Settings

**Settings** in the builder's header:

* **Stop a contact's run when** they reply on WhatsApp, or get a tag you name (say, *booked*). Anyone who asks not to be
  contacted, or is on your do-not-call list, is always stopped.
* **Goal** — the AI decides answer that counts as success. The **Workflows** page shows how many runs reached it.
* **A contact can go through it again**: never, after their last run ends, or 30 days after it.
* **Quiet hours** — no calls or messages between these times, in the contact's own time (read from their number;
  for a country with several time zones, it must be outside quiet hours in all of them). A Call block's call window
  is the contact's time too.
* **End a run after** a number of days (up to 30).

## Publish, test and start

* **Publish** saves a new version. Runs already going finish on the version they started on. If something would stop
  the workflow working — a call with no agent, an unapproved template, a blank left empty — it is marked in red under
  **to check**, and Publish waits until it is fixed. Amber items are worth a look but don't stop you.
* **Test** runs the canvas as it is now — saved or not — on your own phone. Tick **Skip waits** to turn a day's wait
  into seconds. Tests make real calls and send real messages. For a workflow that starts when a call ends, choose
  how that call went — missed, answered, cut off or busy — and the test begins as if it had.
* **Start** (for *Contacts I choose*) picks the group or tag and starts them.
* **Runs** shows the latest contacts and, for each, what happened block by block.
* **Results** puts the last 30 days on the canvas: how many reached each block, and how many took each AI answer.

## Start it from your system

Set **Start when** to **Your system asks** — the card then shows the exact address to call, with this workflow's id
and a copy button — and publish. Then call
[Start a Workflow Run](https://docs.thinnest.ai/api-reference/workflows/start-a-workflow-run.md) with a full API key:

```bash theme={null}
curl -X POST https://app.thinnest.ai/api/v1/workflows/wf_…/runs \
  -H "Authorization: Bearer ta_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "to": "+91 98765 43210", "name": "Asha", "variables": { "order": "10432" } }'
```

* A number you have never sent before becomes a new contact, so a fresh lead can go straight in.
* `variables` are this run's own values: a blank written `{{contact.order}}` fills from `order`.
* `started: false` (not an error) means they are already going through it, or the workflow's settings don't let them
  go through it again.
* [List Workflows](https://docs.thinnest.ai/api-reference/workflows/list-workflows.md) gives every workflow's id and what starts it;
  [Get a Workflow](https://docs.thinnest.ai/api-reference/workflows/get-a-workflow.md) gives its blocks and, for one your system starts, the
  address to send runs to.
* From an AI assistant, the MCP tools `list_workflows` and `start_workflow_run` do the same. The SDKs have
  `workflows.list`, `workflows.get` and `workflows.startRun`.

## Good to know

* Calls and messages are billed exactly as any other call or message. AI decides is not charged.
* Calls keep the usual calling hours in the contact's own time, your plan's lines, and your balance. When every line
  is busy, contacts wait their turn rather than fail.
* On a call a workflow places, the agent's own **[After the call](https://docs.thinnest.ai/agent/after-the-call.md)** messages are not sent — the
  workflow decides what follows, so the contact never gets both.
* **Pause** a workflow from its menu on the Workflows page: contacts wait where they are until you resume it.
  **Delete** stops every run still going.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.