Flows — Overview
A flow is a trigger plus a list of steps. When the trigger fires, Sendiee runs the steps in order. A flow can send a WhatsApp, Instagram or Messenger message, update the customer, move the chat in your inbox, write to a Google Sheet, book a Google Calendar slot, create a payment link, call your own API, branch, wait, and tell your AI assistant what happened.
You build flows in the dashboard under Flows. The Flows API lets you do the same from code: read the building guide, check a flow, save it, test it, switch it on, and read every run. The MCP server gives the same powers to AI agents such as Claude.
Early access
403 FLOWS_NOT_ENABLED.What starts the flow: an AI assistant in a chat, a Sendiee event, a request to the flow's web address, a payment update, or a schedule.
What the flow does, in order. Send a message, update the customer, write to a sheet, book a slot, call an API, branch, wait, and reply to the AI.
One time the flow starts. Every run is kept in run history, step by step, so you can see what each step did and why one failed.
Each saved change raises the flow's version by one. Send the version you read when you save, so you never overwrite someone else's change.
Triggers
Every flow has one trigger. It decides when the flow runs and what the flow gets as {{ input }}. The config for each trigger is in the flow document reference.
| Type | In the dashboard | Runs when | input holds |
|---|---|---|---|
ai_tool | AI assistant | An AI assistant calls the flow as a tool in a chat, after it has collected the flow's inputs from the customer | The inputs the assistant collected, by key |
event | Event | A Sendiee event happens, such as contact.lead_categorized or whatsapp.new_message. Optional conditions narrow it down | The event's data fields |
webhook | Webhook | Another app (a website form, n8n, Zapier, a CRM) sends a request to the flow's own web address | body, query, headers and method of the request |
payment | Payment | Razorpay or Cashfree reports that a payment link was paid, partly paid, expired or cancelled | The payment: amount, amountPaid, currency, status, url, customer, notes and more |
schedule | Schedule | Every few hours, or daily, weekly or monthly at a set time | scheduledAt (when it ran) and schedule (the schedule in words) |
Steps
Steps run one after another. If / else and Choose a path hold their own lists of steps, one per path. The settings and results of every step type are in the flow document reference.
| Type | In the dashboard | What it does |
|---|---|---|
send_message | Send a message | A WhatsApp text or approved template, or an Instagram or Messenger text with an optional image. To the customer or to a number you set |
update_contact | Update the customer | Save details, custom fields, the lead category and tags on the contact |
update_conversation | Update the chat | Change the inbox status, assign the chat to a team or agent, or unassign it |
google_sheets | Google Sheets | Add, find, update or read rows in a sheet |
google_calendar | Google Calendar | Check free slots, book, find, move or cancel appointments |
razorpay_payment_link | Razorpay payment link | Create a link the customer can pay with |
cashfree_payment_link | Cashfree payment link | Create a link the customer can pay with |
http_request | Call an API | Call any https web address: your own server, n8n or Zapier |
condition | If / else | Go down a yes path or a no path |
switch | Choose a path | Pick one of several paths by a value |
wait | Wait | Pause for a while, until a date and time, or until the customer replies |
set_variable | Save a value | Work out a value once and reuse it in later steps |
return | Reply to the AI | Finish the flow and tell the AI (or the caller) what happened |
Google Sheets, Google Calendar, Razorpay and Cashfree steps use a connection to your own account. You make connections on the Connections page under Flows in the dashboard.
Data between steps
Any text in a step’s settings can hold references in double braces. Sendiee fills them in just before the step runs.
| Reference | Holds |
|---|---|
{{ input.<key> }} | What the trigger brought in: the assistant's inputs, the event's fields, the request body, the payment |
{{ contact.name }}, {{ contact.phone }}, {{ contact.email }}, {{ contact.id }} | The customer the run is about |
{{ contact.tags }}, {{ contact.customFields.<key> }} | The customer's tag names and custom fields |
{{ conversation.platform }} | The channel: whatsapp, instagram or messenger |
{{ conversation.brandPhone }}, {{ conversation.customerPhone }} | The business number the customer wrote to, and the customer's number or id |
{{ conversation.status }}, {{ conversation.assignedAgentName }}, {{ conversation.assignedTeamName }} | The chat's inbox status and who it is assigned to |
{{ steps.<step id>.<field> }} | What an earlier step returned, for example {{ steps.find.row.Email }} |
{{ vars.<key> }} | A value saved by a Save a value step |
{{ now.iso }}, {{ now.date }}, {{ now.time }} | The time the step runs, in UTC: ISO date-time, YYYY-MM-DD and HH:mm |
- A value that is only one reference, such as
"{{ steps.lookup.rows }}", keeps its type, so a list or an object reaches the next step whole. Text around a reference turns the result into text. - Lists take a number as a path part:
{{ steps.lookup.rows.0.Name }}. - Inside the braces you can also write a short JavaScript expression, such as
{{ input.name.toUpperCase() }}or{{ steps.lookup.rows.filter(r => r.Qty > 0).length }}. Expressions run in a sandbox with no network or file access. A run may work out up to 200 of them. Helpers:$upper,$lower,$trim,$number,$phone,$json,$ifEmpty,$firstWord,$commas,$money,$nowand$today. nowis in UTC. For a date in your own time zone, use a Save a value step with thedatetransform and atimezone. See Save a value.
Runs and plan limits
One run is one time a flow starts, however many steps it has. A flow that stops at a Wait step and carries on later is still one run. Test runs and practice runs do not count.
| Plan | Flow runs a month |
|---|---|
| Free | 100 |
| Growth, Connect, Creator Lite | 1,000 |
| Pro, Connect Pro, Creator Plus | 5,000 |
| Business | 20,000 |
| Enterprise | Custom |
- Need more? The Extra Flow Runs add-on adds 1,000 runs a month. Buy it in the dashboard.
- Runs reset each month on the same day as your plan’s other monthly limits.
- See your limit and this month’s use with GET /v2.0/billing/plan, under
limits.max_flow_runs_per_month(limit,used,remaining). - When the month’s runs are used up, new runs do not start. An assistant is told the action cannot run and to say a team member will follow up. A flow’s web address answers
429with codeQUOTA. Event, payment and schedule runs are skipped. Owners and admins get an email, at most once a day.
Time limits and automatic switch-off
- When an assistant or a caller waits for the answer (an
ai_toolflow withanswerMode: "wait", or a webhook flow withresponseMode: "wait"), the run stops aftersettings.timeoutSec: 20 seconds by default, up to 120. Other runs get up to 120 seconds. After a Wait, the rest of the run gets another 120 seconds. - A run stops after
settings.maxStepssteps: 50 by default, up to 200. - A flow that fails many times in a row is switched off automatically. It then shows
autoPaused: trueand owners and admins get an email. Switching it on again clears it. - When a live run fails, owners and admins get an email about the first failure of the day. Every failure is in run history.
Credentials are always masked
The API never returns a credential stored in a flow. HTTP step tokens, passwords, API keys and signing secrets, header values with names like Authorization, and the webhook trigger’s secrets come back as ••••••. A webhook flow’s web address is not returned either, because it contains the secret. Copy it from the flow’s page in the dashboard.
When you update a flow, send •••••• back unchanged and the stored value is kept. Steps are matched by id and headers by name. Send a new value to replace it. A new flow cannot hold the mask: POST /v2.0/flows answers 422 MASKED_SECRET, so enter the real credential when you copy a flow.
Versions and edit conflicts
Every flow has a version. It starts at 1 and goes up by one each time the flow is saved. Each run records the version it ran on. A run already waiting at a Wait step finishes with the steps it started with.
PUT /v2.0/flows/{flowId} replaces the whole document. Send the version you read with it. If the flow was saved since, for example by someone in the dashboard, the API answers 409 VERSION_CONFLICT and changes nothing. Get the flow again, reapply your change and save. Leave version out only when you mean to overwrite.
Scopes
flows:read: list and get flows, the building guide, check a flow without saving (POST /flows/validate), inbox and account lookups, and run history.flows:write: create, update, switch on or off, delete, test, and connect to or disconnect from assistants.
Every request uses Authorization: Bearer <API key or OAuth access token>. See API Key Scopes.
Build a flow with an API key in 5 calls
This flow messages the owner on WhatsApp when a lead turns Hot. It uses an approved template called hot_lead_alert whose message has two blanks. Always follow this order: read the guide, check, save switched off, practice-run, then switch on.
1. Read the building guide
curl "https://api.sendiee.com/v2.0/flows/schema" \
-H "Authorization: Bearer YOUR_API_KEY"It returns every trigger and step type with its settings and results, the variables, and a complete example. See Get the building guide.
2. Check the flow without saving it
curl -X POST "https://api.sendiee.com/v2.0/flows/validate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Hot lead alert",
"description": "Tells the owner on WhatsApp when a lead turns Hot.",
"trigger": {
"type": "event",
"config": {
"eventType": "contact.lead_categorized",
"conditions": { "logic": "AND", "rules": [{ "field": "data.category", "operator": "eq", "value": "Hot" }] }
}
},
"steps": [{
"id": "alert",
"type": "send_message",
"label": "Tell the owner",
"config": {
"channel": "whatsapp",
"from": "917012345678",
"to": "919800000000",
"kind": "template",
"templateName": "hot_lead_alert",
"language": "en",
"bodyParameters": ["{{ contact.name }}", "{{ contact.phone }}"]
}
}],
"settings": { "answerMode": "background" }
}'{
"success": true,
"data": {
"ok": true,
"errors": []
}
}Fix every error it lists, then check again. It also checks that the template is approved and that the step fills exactly its number of blanks.
3. Save it. It starts switched off
curl -X POST "https://api.sendiee.com/v2.0/flows" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @hot-lead-alert.jsonSave the document from step 2 as hot-lead-alert.json and send it. The answer is 201 with the saved flow: keep its flowId. A flow made through the API is saved with status: "paused" unless you send "active".
4. Practice-run it
curl -X POST "https://api.sendiee.com/v2.0/flows/6741a2b39d2b4e0011ac1101/test" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "input": { "category": "Hot", "previousCategory": "Warm" }, "phone": "919876543210" }'A practice run (mode: "dry", the default) runs every step but only pretends to send, write or charge. The answer shows each step with its status and result. See Test a flow.
5. Switch it on
curl -X PATCH "https://api.sendiee.com/v2.0/flows/6741a2b39d2b4e0011ac1101/status" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "active" }'Switching on means it runs by itself
ai_tool flow is different: it does nothing until you give it to an assistant. See Flows in AI assistants.API endpoints
- GET/v2.0/flows/schemaGet the building guide
- GET/v2.0/flowsList flows
- GET/v2.0/flows/{flowId}Get a flow
- POST/v2.0/flows/validateCheck a flow without saving
- POST/v2.0/flowsCreate a flow
- PUT/v2.0/flows/{flowId}Update a flow
- PATCH/v2.0/flows/{flowId}/statusSwitch a flow on or off
- DELETE/v2.0/flows/{flowId}Delete a flow
- GET/v2.0/flows/inboxTeams, agents and inbox statuses
- GET/v2.0/flows/accountsInstagram accounts and Facebook pages
- POST/v2.0/flows/{flowId}/testTest a flow
- GET/v2.0/flows/runsList runs
- GET/v2.0/flows/runs/{runId}Get a run, step by step
- POST/v2.0/flows/{flowId}/connectGive a flow to assistants
- POST/v2.0/flows/{flowId}/disconnectTake a flow off assistants
Every success answers { success: true, data }, plus pagination on lists. Every error answers { error: true, code, message }, plus details when a document has validation errors.
Errors every Flows endpoint can return
| Status | Code | Meaning |
|---|---|---|
| 400 | BAD_STATUS | Switch on or off: status is not active or paused |
| 400 | BAD_FLOW_ID | List runs: flowId is not a valid id |
| 400 | BAD_ASSISTANT_IDS | Connect or disconnect: assistantIds is not a list |
| 400 | BAD_TOOL_ID | Disconnect: toolId is missing or not a valid id |
| 403 | INSUFFICIENT_SCOPE | The key lacks flows:read or flows:write. required_scope names the missing one |
| 403 | FLOWS_NOT_ENABLED | Flows is not on for this account yet. Every Flows endpoint answers this |
| 403 | LIMIT_EXCEEDED | Connect: the plan's tool limit is reached, so the flow's tool cannot be created |
| 404 | FLOW_NOT_FOUND | Get or update: no flow with that id on this account |
| 404 | NOT_FOUND | Switch on or off, delete, test or connect: no flow with that id. Disconnect: no such tool on this flow |
| 404 | RUN_NOT_FOUND | No run with that id, or it is older than the run history keeps |
| 404 | ASSISTANT_NOT_FOUND | Connect: one of the assistantIds is not an assistant on this account |
| 409 | VERSION_CONFLICT | Update: the flow changed since you read it. Get it again and reapply your change |
| 422 | VALIDATION | Create or update: the document has errors. details lists each one as { path, message } |
| 422 | MASKED_SECRET | Create: the document still holds a masked credential (••••••). Enter the real value |
| 422 | EMPTY_FLOW | Switch on: the flow has no steps |
| 422 | NOT_AI_TOOL | Connect: only a flow with the ai_tool trigger can be given to an assistant |
| 429 | RATE_LIMIT | Test: the account used its 60 test runs for this hour |
| 500, 502 | FLOWS_FAILED | Something failed on our side, or the inbox did not answer a lookup. Try again |