# Build a workflow with AI

Describe a flow in plain words and the assistant drafts it for you to review: the draft sits in the side panel until you put it on the canvas, nothing is saved until you press Save, and nothing runs on customers until the workflow is published.

## Getting here

**Automate → Workflows**, then **Build with AI** to start a new workflow with the assistant open — or open any workflow and click **AI** in the editor toolbar.

## Before you start

- An **owner**, **admin** or **agent** can use Build with AI. Putting a draft on the canvas and saving it follow the same permissions as any workflow; publishing is still an **owner** or **admin** action — see [Test and publish a workflow](/help/workflows/test-and-publish).
- Building and running workflows depends on your plan; see [pricing](/pricing).
- Nothing outside Inchat has to be connected, but the assistant can only name what already exists in the workspace: teammates, teams, contact fields, lifecycle stages, deal stages, events, forms, published workflows, AI agents, connected channels and approved WhatsApp templates. An empty workspace still gets a draft back; it leans on generic steps such as **Escalate** instead of a named team or agent.
- The workflow must not be published. On a published workflow the panel is read-only until you stop it.

## Set up

1. On **Automate → Workflows** click **Build with AI**. A blank workflow opens with the assistant beside the canvas. To change a workflow you already have, open it and click **AI** in the toolbar instead.
2. In the box **Describe the workflow**, say what should happen and when — the panel says English, Malay or Chinese all work. Name your teams, stages, templates and tags as they appear in your workspace. Press Enter to send; Shift+Enter starts a new line. On an empty conversation you can also click one of the three example prompts, which sends it straight away.
3. Read the reply. It is one of three things: a question or two about the structure of the flow, an answer (when you asked something rather than asked for a change), or a draft.
4. If it asks questions, answer them in one message, or say “just draft it” and it will assume.
5. On a draft card, read what it did, then **Needs your input**, any ⚠ warnings, and **Assumptions & notes**. On a change to an existing flow the card also has a **Changes** summary.
6. Click **Put it on the canvas** (or **Apply changes** when you are editing a flow). The button changes to **Applied to canvas**.
7. Review the steps on the canvas, fix what **Needs your input** lists, and press **Save**. Publishing is a separate step.

## How it works

- You describe what the flow should do in one message. The assistant replies with a clarifying question, an answer about the flow already open on the canvas, or a draft.
- It reads this workspace's own setup: teammates, teams, the tags in use, contact fields, lifecycle stages, deal stages, upcoming events, forms, published workflows, enabled AI agents, connected channels and their approved WhatsApp templates, plus the business description and knowledge-base titles the workspace has already written for its AI agent.
- That setup holds no customer message, no customer phone number and no conversation. Beyond it, the assistant reads only what you type and, when you are editing, the flow on the canvas.
- Each of those lists is capped, so in a workspace with a very large number of teammates, tags, templates, published workflows, upcoming events, forms or deal stages the assistant sees only the first part of the list.
- The assistant is told to write names, not ids, into every field that needs one. Inchat swaps each name for the id of the single matching row in your workspace. The match is on the exact name, ignoring capitals and extra spaces, never on part of a name.
- An id the assistant makes up on its own is treated exactly like an unknown name: it is never trusted.
- A team, teammate or AI agent that does not exist turns that step into **Escalate**, which flags the conversation for a person without choosing one, and a line under **Needs your input** says so. The step is never widened to an assignment you did not ask for.
- A lifecycle stage, contact field or event that does not exist, or a workflow that a **Remove from Workflow** step is told to target that does not exist, means that step is left out, and **Needs your input** says which one and where to create it.
- A channel named on a **Send a Message** step that is not connected is dropped, so the message goes out on the last interacted channel. A channel named in the trigger's channel list that is not connected is left out of that list.
- A WhatsApp template that is not approved in this workspace keeps its step, under the name the assistant gave it as a placeholder. **Needs your input** and a ⚠ warning tell you to create and approve the template before publishing.
- A deal stage or a hand-off workflow that does not exist also keeps its step with the name typed; **Needs your input** says to create the stage, or to publish a workflow with that exact name.
- A form that does not exist, on a **Form Submitted** trigger, is replaced by a condition on the form's name, so the flow still fires only for a form of that name and not for every form.
- A draft then has to pass the same save checks a hand-built workflow passes, and the canvas has to be able to draw it. If it fails, it goes back to the assistant once with the problems listed to correct.
- After that a separate check, which does not depend on the assistant, adds notes to the card. It warns when a free-text step (Send a Message, Ask a Question, AI Reply) can run outside WhatsApp's 24-hour window, either because the trigger fires long after the customer last wrote or because waits and unanswered-question timeouts add up to that long before it. These window checks run only when a WhatsApp number is connected.
- It warns when an AI Reply step has no **Escalate**, **Assign To (human)** or **Assign To (team)** step anywhere in the flow.
- It warns when a message follows a wait of an hour or more, or a wait until a clock time, with nothing holding it to waking hours — a Wait step set to **Only continue during business hours** or to a daily window does not count, and neither does having a **Date & Time (business hours)** step anywhere in the flow.
- It warns when an Ask a Question offers more answers than WhatsApp can show in a list, and notes when a question has enough answers that WhatsApp shows a list instead of buttons.
- It warns when a named template is not approved or a Conversions API event name would be refused by Meta.
- It adds information notes when a question has no timeout path, when a **Date & Time (business hours)** step carries business hours that you should confirm, when steps are nested deeply or the flow is long, and when a flow only updates records and messages nobody.
- Warnings appear as ⚠ lines on the card. Information notes are collected under **Assumptions & notes**, together with what the assistant says it decided without being told.
- **Needs your input** collects what the assistant listed itself (business hours, a template to approve, a team to create) and the lines Inchat added for names that did not match. Inchat's own lines carry an **open** link to the settings page where you fix it, which opens in a new tab.
- Nothing is on the canvas until you click the card's button. Clicking it replaces the whole canvas — the workflow's name, trigger, conditions and steps — with the draft.
- If you ask for another change before applying a draft, the assistant edits that draft, not the canvas behind it.
- When you ask for a change to an existing flow, the assistant is told to return the whole flow and keep every step you did not mention exactly as it is. The **Changes** summary lists what was added, removed and changed, so check it rather than trusting the instruction.
- Applying is not saving. **Save** stores the workflow through the same checks as a hand-built one, and publishing is the same separate step it always is.
- While it drafts, the assistant is told to follow rules that keep a flow working on WhatsApp. After 24 hours of customer silence only an approved template can reach the customer, so a flow that starts from an order, a reminder, a booking change or a silent conversation should speak through templates. If no fitting template exists it uses a clearly named placeholder and lists it under **Needs your input**.
- It is told never to invent a team, teammate, stage, contact field, template, AI agent, event or workflow, and to leave a step out or use the nearest generic step when the business needs one that does not exist.
- It is told to give every question a way out and to follow every AI Reply with a human fallback.
- It is told to keep menus short and option labels short.
- It is told that any wait which could land outside waking hours must be held to the morning, and to reach for **Only continue during business hours** only when the next step needs your team to be there.
- It is told not to build a loop unless you ask for one, to keep nesting shallow and flows short, and to split a bigger design into a main flow plus hand-offs.
- It is told to prefer contact tags over conversation tags for anything a later broadcast or segment should find.
- When you do not state a timezone or business hours it is told to assume defaults and to list them under **Needs your input** so you confirm them.
- These are instructions to the assistant, not guarantees. The checks listed above are the ones Inchat runs itself; the rest rests on the assistant following the instruction, and you can edit the result afterwards and reintroduce anything it avoided.

## When it fails

- Whatever goes wrong, a refused turn changes nothing: the canvas, the saved workflow and every conversation stay as they were. The assistant has no path to save, publish or send; the most it returns is a draft.
- Your description is too vague: the assistant asks a small number of clarifying questions, and after that it drafts with what it assumed and lists the assumptions under **Assumptions & notes**. If it keeps asking after its budget for questions is spent, the panel shows “The builder kept asking questions instead of drafting. Add a little more detail and try again.”
- Something the description needs does not exist: the step is turned into **Escalate**, left out, or kept as a placeholder, and a line under **Needs your input** says which. In two small cases nothing is said: an @mention of someone who is not a teammate is dropped, and so is the channel on a **Start a WhatsApp Chat (new number)** step that names one that is not connected.
- The assistant's reply cannot be read as a workflow: it is asked once more for plain JSON. If that fails too, its prose is shown back as an answer when it reads like one; otherwise the panel shows “The builder returned something that was not a workflow. Nothing was changed — try rephrasing.”
- The assistant's reply has the wrong shape, or the model cannot be reached in time: the panel shows “The builder's answer did not have the expected shape. Nothing was changed — try again.” or “The builder could not reach the model. Nothing was changed — try again.”
- The draft fails the save checks: it is corrected once. If the second try fails too, the panel shows “The draft could not be made valid” with the first few problems and “try describing the flow in smaller pieces.”
- The draft cannot be drawn when you click the card's button: the editor shows “The AI draft could not be drawn” with the reason, and the canvas is left as it was.
- The flow you are editing is too big for the assistant to rewrite: it still answers questions about the flow, but a request to change it is refused with “This workflow has N steps. Build with AI rewrites the whole flow on every edit…” and you change it by hand or split it into a smaller workflow.
- “That request was not valid.” appears when the conversation has grown too long, when one message is very long, or when the flow on the canvas is larger than the assistant will accept at all. The first two repeat on every later message until you close the assistant and open it again to start a fresh conversation; the canvas is untouched. For an oversized canvas the fix is a smaller workflow.
- Your plan does not include workflows, the AI workflow builder is switched off on this deployment (“The AI workflow builder is switched off on this deployment.”), or the workspace has used its turns for the day (“This workspace has used its N AI builder turns for today. It resets at midnight UTC.”): the turn is refused with that message.
- An unexpected failure reading the workspace's setup, reading the usage record, or writing it, shows a panel message and asks you to try again; if only the usage write fails, the draft the assistant made is discarded and not shown. A failure reading any ONE of the setup lists — channels, teams, members, lifecycle stages, contact fields, tags, templates, deal stages, published workflows, agents, events, forms or knowledge — does not reach that message at all: every read in that batch falls back to an empty list, so that one list silently comes back empty instead. A name from that list then counts as not found, with the same result described above for a name that does not exist: **Escalate**, the step left out, or a placeholder. Tags are the one exception: they are never name-matched at all (see Limits), so a failed tags read changes nothing there.
- The workflow is published: the box is disabled and reads “Stop the published flow to edit it with AI.” The editor's banner says to stop and save before changing steps; see [Test and publish a workflow](/help/workflows/test-and-publish).

## Limits

- It never saves, publishes or sends anything. It returns a draft; Save and Publish are the same actions, with the same role checks, as building a workflow by hand.
- It is a drafting aid, not a tester. A draft that passes its checks has not been run against a conversation. Test it before you publish — see [Test and publish a workflow](/help/workflows/test-and-publish).
- The warnings and notes do not block anything: you can still put the draft on the canvas and save it with a warning showing. Two things are still enforced later, with different reach. A flow that starts when a conversation goes quiet is refused a save that KEEPS it free-text and published from the editor — but not from the workflows list's status chip, which never runs that check, so a free-text step can reach a published Contact Inactive flow that way. A template that is not approved is refused before anything sends, on every send path (the workflow's own send and Start a WhatsApp Chat both call the same approval check).
- Names match exactly. A near-miss such as a shortened team name counts as not found, and if two teammates or two teams share a name, neither matches.
- Tag names are not checked. Nothing compares the tags the assistant writes with the tags in your workspace, so read every tag step yourself.
- Only some of what the assistant is told is checked. Nothing checks that it avoided a loop, chose a contact tag over a conversation tag, or wrote sensible customer copy, and deep nesting and a long flow are only an information note.
- If every channel named in the trigger is unmatched, the trigger keeps no channel filter and would run on every channel until you pick one in the trigger settings. The note says only that the channel was left out of the trigger's channels.
- The assumed timezone and business hours are not always listed under **Needs your input**: the assistant is told to list them, but if it writes a wait until a clock time without a timezone, a default one is filled in without a note.
- It never sees a customer message, so it cannot draft a flow from what a specific customer said in the past.
- Editing rewrites the whole flow every time, so editing an existing workflow is limited to a fixed number of steps. An empty canvas has no such limit going in. The refusal names the number.
- If a step on the canvas is still incomplete when you send a message, the assistant is not shown the canvas (unless you are refining a draft you have not applied yet) and drafts from scratch, with no **Changes** summary. Applying that draft replaces everything on the canvas.
- The editor's undo takes back the steps only. The workflow's name, trigger and conditions are set directly and are not part of undo, although the panel says “⌘Z undoes.”
- The assistant sees only the most recent turns of the conversation, so something you asked for at the start of a long conversation may be forgotten.
- A workspace with a very large number of templates, teammates, tags, published workflows, events, forms or deal stages is shown only the first part of each list. A template past the cut-off counts as not approved.
- A draft that fails the save checks is corrected at most once; a second failure refuses the turn.
- Every turn counts against a fixed daily number for the workspace, reset at midnight UTC: questions, answers and turns the assistant refuses count as well as drafts. The refusal names the number.

## Best practices

- Name things as they appear in your workspace: the team, the template, the stage, the channel. A name that does not match is the most common reason a step comes back as **Escalate** or a placeholder.
- Say when the flow starts and who takes over if it cannot finish. A described hand-off gets a real one; an undescribed one is left to the assistant to assume.
- Read **Needs your input** before anything else. It is the list of what the draft could not do for you.
- Look through the tag steps yourself: nothing checks them.
- Describe a big flow in pieces. The product's own advice when a draft fails is to describe the flow in smaller pieces, and a flow past the edit limit cannot be changed by the assistant at all.
- To change a flow, describe the change on the open flow instead of describing the whole flow again, then read the **Changes** summary.
- Test the applied flow before you publish it. A draft is a starting point, and the edit you make afterwards is yours to check.

## Use cases

- Sarah Chen messages Aurelia Skincare for the first time on WhatsApp. One of the panel's own example prompts asks the assistant to greet a first-time customer, ask whether they want product information or order status, and route order questions to a Support team. If the workspace has no team by that name, that step comes back as **Escalate**, and **Needs your input** says to create the team.
- After Michael Torres pays, a flow confirms the order, asks the next day whether it arrived and later asks for a review. Because those follow-ups come long after his last message, the assistant is told to use approved templates for them and to hold them to waking hours, and the card carries a ⚠ warning if a free-text step still sits outside the window.
- You ask a question about the open flow — “who reads a follow-up that fires at 3am?” — and the answer comes back as a chat bubble. Nothing is drafted and the canvas does not change.
- You ask “make it Malay” on a flow already on the canvas. The card shows a **Changes** summary, and **Apply changes** puts the revised flow on the canvas for you to review.

## FAQ and troubleshooting

### Does it publish the workflow it drafts?

No. It only returns a draft, which sits in the side panel until you click **Put it on the canvas**. You still press **Save**, and publishing is the separate step that makes a workflow run on live conversations.

### Can it invent a team, teammate or template that does not exist yet?

Not a team, teammate or AI agent: an unknown one turns that step into **Escalate**, and **Needs your input** says so. A template is different. The step can keep a name that is not approved, as a placeholder, flagged with a warning; it will not send until the template is approved. Tag names are not checked at all.

### It showed a warning under the draft. Do I have to fix it before saving?

No. Warnings and notes do not block **Put it on the canvas** or **Save**. Read the window and human-fallback warnings before you publish, though, and remember that a template that is not approved will not send.

### Can I use it on a workflow that is already live?

Not while it is published. The box is disabled and says to stop the published flow first. See Test and publish a workflow for stopping and republishing.

### It asked me questions instead of drafting. What now?

Answer them in one message, or say “just draft it” and it will assume and list its assumptions under **Assumptions & notes**. If it keeps asking after its budget for questions, add a little more detail to your description.

### I applied a draft and my old canvas is gone. Can I get it back?

The editor's undo (⌘Z) takes back the steps. It does not take back the workflow's name, trigger or conditions, which the draft also replaced, so check those after undoing.

### The panel says “That request was not valid.” What happened?

The conversation has grown too long, or one message is too long, or the flow on the canvas is larger than the assistant will accept. For the first two, close the assistant and open it again; the canvas is untouched. For the third, split the flow into a smaller workflow.

### Does the assistant read my customers' conversations?

No. It reads your workspace's setup (teammates, teams, tags, templates, stages and so on), what you type, and the flow on the canvas. It is not given customer messages, customer phone numbers or conversations.

## Related

- [Workflows: how a flow runs](https://inchat.inseller.my/help/workflows/workflows-overview)
- [Test and publish a workflow](https://inchat.inseller.my/help/workflows/test-and-publish)
- [Conditions and variables](https://inchat.inseller.my/help/workflows/conditions-and-variables)
- [Workflow triggers](https://inchat.inseller.my/help/workflows/workflow-triggers)

---

Source files: `src/lib/workflows/ai-builder/spec.ts`, `src/lib/workflows/ai-builder/prompt.ts`, `src/lib/workflows/ai-builder/snapshot.ts`, `src/lib/workflows/ai-builder/resolve.ts`, `src/lib/workflows/ai-builder/run.ts`, `src/lib/workflows/ai-builder/lint.ts`, `src/lib/workflows/ai-builder/log.ts`, `src/app/(app)/workflows/ai-builder-actions.ts`, `src/app/(app)/workflows/page.tsx`, `src/app/(app)/workflows/new/page.tsx`, `src/components/workflows/WorkflowAiBuilderPanel.tsx`, `src/components/workflows/WorkflowCanvasEditor.tsx`, `src/components/workflows/use-step-history.ts`, `src/components/workflows/WorkflowStepConfigDrawer.tsx`, `src/lib/i18n/messages/workflow-ai.ts`, `src/lib/workflows/window-lint.ts`, `src/lib/workflows/workflow-input-schema.ts`, `src/lib/workflows/dispatch-send.ts`, `src/lib/workflows/template-consent-gate.ts`, `src/lib/workspace/require-role.ts`, `src/lib/access/permissions.ts`
