# POST /conversation-flows

**Resource:** [CONVERSATION_FLOWS](./conversation-flows.md)  
**MCP tool:** `create_conversation_flow`  
**Scopes:** `automations:write`  
**Write operation:** yes

Create a conversation flow as a switched-off draft, blank or from a template (its lead step goes to your default pipeline). Then test_conversation_flow, publish_conversation_flow, and switch_conversation_flow to switch it on.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `name` | body | string | no | What it is called, e.g. "Get a quote" (up to 120 characters). Defaults to the template's name. |
| `description` | body | string | no | What it does, for your team. |
| `template` | body | string | no | Start from a ready-made flow (list_conversation_flow_templates). It starts switched off. |
| `definition` | body | object | no | The flow: { channels: [{ channel: instagram \| facebook \| sms \| whatsapp \| chat \| email (chat = the Live Chat widget on a website or in a client portal), accounts: [ids from list_conversation_flow_accounts; [] = every account on that channel] }], starts: [...], steps: [...], disclosure: "You're chatting with our automated assistant. Our team can see this conversation and can step in at any time." (sent once when the flow starts, where the law asks a business to say a chat is automated; "" = off) }. Starts (types keyword, any_message, comment, ad, link, story_reply, menu): { type: "keyword", words: ["quote", "price"], match: "word" (the word anywhere) \| "exact" (the whole message) }; { type: "any_message", once_every_days: 30 (the channel's default when nothing else matches, at most once per conversation in that many days; 0 = every time) }; Instagram and Messenger only: { type: "comment", post_ids: [Meta post or media ids; [] = any post], words: [[] = any comment], public_reply: "Sent you a message!" } (the first message goes as a private reply to the comment, so the first step must be a message with buttons or a question), { type: "ad", ad_ids: [[] = any Click-to-DM ad] }, { type: "link", ref: "spring-offer" } (people who open ig.me/<account>?ref=spring-offer or m.me/<page>?ref=spring-offer), { type: "story_reply", words: [[] = any reply] }, { type: "menu", label: "Get a quote", ice_breaker: true (a starter question on a new chat, up to 4 per account), menu: false (a button in the chat menu, up to 30 characters) }. A menu button, ice breaker, ad or link starts its flow even mid-flow; then someone mid-flow carries on; then a story reply or keyword; then any message. An automation can also start any flow (the "Start a conversation flow" action). The first step runs first. Every step has id (letters, numbers, _ or -, unique), name (shown in the builder) and type (message, ask, wait, lead, automation, ai_reply, booking, call, handoff, end); only_channels limits it to some channels (skipped on the others). message: text, buttons [{ id, label (up to 20 characters, up to 10), next (step id, or null to end) }], next (without buttons: the step after), else_next (they typed something else; null = ask once more, then hand to a person), no_reply { after_minutes, next } (Instagram and Messenger: at most 1380 minutes). ask: text, save_as (answer, first_name, full_name, email, mobile, suburb, postcode; email, mobile and names go on their contact, and an email or mobile makes the contact), key (for save_as answer: the name it is kept under), retry_text (when the answer cannot be read; asked once, then a person takes over), next, no_reply. wait: minutes, next. lead: pipeline_id, stage_id, deal_name ({first_name} allowed), next (makes an opportunity once they have given an email or mobile). automation: action (add_tag, remove_tag, move_stage, run_automation), tag (add_tag, remove_tag), pipeline_id and stage_id (move_stage), automation_id (run_automation), next; acts on the opportunity this flow made, else the contact's latest open one. ai_reply (the AI replies; old "evie" steps read as ai_reply with mode answer): mode "answer" (answers questions from knowledge bases with buttons: text (opening line), kb_ids [1 to 5 knowledge base ids], back_label and back_next (the button back into the flow), person_label (hands to a person), max_replies (answers before the flow moves on to next, or hands over), next) or mode "goal" (the workspace's AI holds the conversation until a goal is reached: goal (answer_questions, book_time, qualify), instructions (up to 2000 characters, what the AI should do and know here), tools [lookup_account, work_order_status, check_pricing, check_availability, book_appointment, cancel_booking, reschedule_booking, schedule_callback, take_message, create_invoice_payment_link; book_time needs book_appointment], kb_ids [[] = the account's own], send (inherit = the account's AI setting, draft = a person approves each reply, auto_send), max_replies (AI replies before a person takes over), text (optional opening line), next (goal reached: Done), person_next (needs a person; null = hand to a person), no_reply { after_minutes, next } (they stop replying)). The flow's answers are given to the AI, and details it secures are saved as answers. booking: event_type_id (a bookable event type), text, slots (2 to 6 times offered as buttons), none_label and none_next, booked_text ({booking_time} allowed), next; needs their email first (an ask step) unless they are already a contact. call: voice_agent_id (a voice agent outbound setup id), text, next; rings their mobile now (an SMS or WhatsApp conversation, or an earlier mobile question). handoff: text (marks the conversation Needs a person and stops). end: text. Texts can use {first_name} and any saved answer, like {suburb}. Buttons show as tap buttons on Instagram and Messenger, chips in website chat, "Reply with a number" on SMS and WhatsApp, and links in an email (plus "or reply with the number"). Saved even with problems (they come back in draft_problems) and checked again on publish. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/conversation-flows"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"name":"...","description":"...","template":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`