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.

Trigger

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.

Steps

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.

Run

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.

Version

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.

TypeIn the dashboardRuns wheninput holds
ai_toolAI assistantAn AI assistant calls the flow as a tool in a chat, after it has collected the flow's inputs from the customerThe inputs the assistant collected, by key
eventEventA Sendiee event happens, such as contact.lead_categorized or whatsapp.new_message. Optional conditions narrow it downThe event's data fields
webhookWebhookAnother app (a website form, n8n, Zapier, a CRM) sends a request to the flow's own web addressbody, query, headers and method of the request
paymentPaymentRazorpay or Cashfree reports that a payment link was paid, partly paid, expired or cancelledThe payment: amount, amountPaid, currency, status, url, customer, notes and more
scheduleScheduleEvery few hours, or daily, weekly or monthly at a set timescheduledAt (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.

TypeIn the dashboardWhat it does
send_messageSend a messageA 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_contactUpdate the customerSave details, custom fields, the lead category and tags on the contact
update_conversationUpdate the chatChange the inbox status, assign the chat to a team or agent, or unassign it
google_sheetsGoogle SheetsAdd, find, update or read rows in a sheet
google_calendarGoogle CalendarCheck free slots, book, find, move or cancel appointments
razorpay_payment_linkRazorpay payment linkCreate a link the customer can pay with
cashfree_payment_linkCashfree payment linkCreate a link the customer can pay with
http_requestCall an APICall any https web address: your own server, n8n or Zapier
conditionIf / elseGo down a yes path or a no path
switchChoose a pathPick one of several paths by a value
waitWaitPause for a while, until a date and time, or until the customer replies
set_variableSave a valueWork out a value once and reuse it in later steps
returnReply to the AIFinish 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.

ReferenceHolds
{{ 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, $now and $today.
  • now is in UTC. For a date in your own time zone, use a Save a value step with the date transform and a timezone. 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.

PlanFlow runs a month
Free100
Growth, Connect, Creator Lite1,000
Pro, Connect Pro, Creator Plus5,000
Business20,000
EnterpriseCustom
  • 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 429 with code QUOTA. 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_tool flow with answerMode: "wait", or a webhook flow with responseMode: "wait"), the run stops after settings.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.maxSteps steps: 50 by default, up to 200.
  • A flow that fails many times in a row is switched off automatically. It then shows autoPaused: true and 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
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
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
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.json

Save 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
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
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" }'

API endpoints

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

StatusCodeMeaning
400BAD_STATUSSwitch on or off: status is not active or paused
400BAD_FLOW_IDList runs: flowId is not a valid id
400BAD_ASSISTANT_IDSConnect or disconnect: assistantIds is not a list
400BAD_TOOL_IDDisconnect: toolId is missing or not a valid id
403INSUFFICIENT_SCOPEThe key lacks flows:read or flows:write. required_scope names the missing one
403FLOWS_NOT_ENABLEDFlows is not on for this account yet. Every Flows endpoint answers this
403LIMIT_EXCEEDEDConnect: the plan's tool limit is reached, so the flow's tool cannot be created
404FLOW_NOT_FOUNDGet or update: no flow with that id on this account
404NOT_FOUNDSwitch on or off, delete, test or connect: no flow with that id. Disconnect: no such tool on this flow
404RUN_NOT_FOUNDNo run with that id, or it is older than the run history keeps
404ASSISTANT_NOT_FOUNDConnect: one of the assistantIds is not an assistant on this account
409VERSION_CONFLICTUpdate: the flow changed since you read it. Get it again and reapply your change
422VALIDATIONCreate or update: the document has errors. details lists each one as { path, message }
422MASKED_SECRETCreate: the document still holds a masked credential (••••••). Enter the real value
422EMPTY_FLOWSwitch on: the flow has no steps
422NOT_AI_TOOLConnect: only a flow with the ai_tool trigger can be given to an assistant
429RATE_LIMITTest: the account used its 60 test runs for this hour
500, 502FLOWS_FAILEDSomething failed on our side, or the inbox did not answer a lookup. Try again