Skip to content

Workflows

Chat with a workflow

Let a published workflow answer chats with its Reply block: on your website's widget, at a chat link, through POST /v1/chat, or for an agent that answers with it.

Guide3 min readUpdated 27 October 2026

A workflow can answer a chat the way an agent does. Each message starts a run, and the text of its Reply block is the answer, streamed back like an agent's reply. Use it when an answer needs several steps: check the message, look something up, then answer.

Where a workflow can chat

ChannelWhere you set it upWhich version answers
PlaygroundPick the workflow in the Playground's picker. Its steps show beside the chatYour saved draft, so you can try it before publishing
Website widgetWidget in the sidebar: choose Workflow and pick it, then copy the embed code. It uses data-workflow-idThe published version
Chat linkWidget in the sidebar, with the workflow picked: a full-page chat at https://app.sentientone.ai/c/<id>, for anyone with the link or only for people signed in to your accountThe published version
APIPOST /v1/chat with workflow_id. The API keys page has code samples when you choose WorkflowThe published version
An agent's chatsThe agent's Settings or Deploy tab, under AnswersThe published version

Steps

  1. 1

    Add a Reply block

    Put a Reply block where the answer is ready, usually after an Agent block, and set its Reply text to {{last.output}}. Give every path that should answer its own Reply. The Website chatbot template is set up this way.

  2. 2

    Read the message

    A chat run's input has message (what the person wrote), history (the conversation so far), conversation_id and channel (playground, widget, link or api), plus agent_id when an agent answers with the workflow. Use {{input.message}} in the first block.

  3. 3

    Try it in the Playground

    Pick the workflow in the Playground and send a message. If it has no Reply block, the Playground asks you to add one, and Open in designer takes you there.

  4. 4

    Publish

    Every channel except the Playground uses the published version.

  5. 5

    Choose where it chats

    Copy the widget's embed code, share the chat link, call POST /v1/chat, or set an agent to answer with it.

POST /v1/chat
curl -N https://api.sentientone.ai/v1/chat \  -H "Content-Type: application/json" \  -H "X-Api-Key: $SENTIENTONE_API_KEY" \  -d '{"workflow_id": "YOUR_WORKFLOW_ID", "message": "Where is my order A-1042?"}'
Widget embed code for a workflow (example)
<script  src="https://app.sentientone.ai/widget.js"  data-widget-key="pk-so-…"  data-workflow-id="YOUR_WORKFLOW_ID"  defer></script>

POST /v1/chat answers with the same server-sent events as an agent: meta, then delta events with the answer, then done with the workflow_run_id. Send the conversation_id from meta to continue the conversation. From a browser, use the workflow's publishable widget key in X-Widget-Key instead of your secret key; it works only from the websites you allow.

Answer with a workflow

An agent can hand its chats to one of your published workflows. On the agent's Settings tab (or its Deploy tab), under Answers, choose the workflow in Answer with a workflow. Every message to the agent (its widget, the API and the Playground) then goes through the workflow, which answers with its Reply block. Widgets and code that already call the agent don't need to change.

If the workflow fails before it replies, ends without reaching a Reply block, isn't published or was deleted, the agent answers itself, and its trace says workflow_fallback. The person chatting always gets an answer.

Credits

Each message costs 1 credit from your balance, whichever channel it comes from. That covers the run: its Agent and AI blocks don't charge again. A run that ends without an answer is refunded. At zero credits the API answers 402 OUT_OF_CREDITS, and the widget and chat links tell visitors the assistant is unavailable right now.

If something goes wrong

The chat says the workflow finished without a Reply block

The run took a path with no Reply block (WORKFLOW_NO_REPLY). Add a Reply to every path that should answer, for example the Fail path of a Guardrail check. The message's credit is refunded. This happens when you chat with the workflow itself (the widget, a chat link or POST /v1/chat with workflow_id); when an agent answers with the workflow, the agent answers instead.

422 WORKFLOW_NO_REPLY_BLOCK

The published workflow has no Reply block at all. Add one and publish again.

409 WORKFLOW_NOT_PUBLISHED

Only the Playground chats with a draft. Publish the workflow for the widget, chat links, the API and agents.

The widget refuses with WIDGET_KEY_SCOPE

A workflow needs its own widget key, with data-workflow-id. Copy the embed code from the Widget page with the workflow picked; an agent's key doesn't work for a workflow.

Still stuck?

Email us with what you tried and any request id. A person replies.

support@sentientone.ai