Skip to content
Docs

Chat

Chat starts a flow from a chat message POSTed to a webhook. It is the trigger for building your own chat surface over HTTP: each request is one turn, and a thread id groups the turns of one conversation so an agent can keep context across them. You find it on the node picker’s Triggers — start the flow shelf.

The node has a single webhook handle, which connects into Start’s trigger handle. Like every inbound trigger it must be wired into Start to start anything; see Triggers & arming.

The Chat node's settings form, with the fields described below
The Chat node's settings form, with the fields described below
FieldTypeDefaultDescription
Webhook (webhookId)string ✦ (required) — The webhook that receives inbound chat messages and triggers this flow.
Max history (maxHistory)integer ✦ (required) — How many prior messages of the conversation to keep as history for context.
Without overlapping (withoutOverlapping)boolean (optional) true Prevent a new run from starting while a previous run for this trigger is still in progress.

Fields marked ✦ accept expressions.

POST a JSON body to the webhook’s URL with the message, a thread id, and any extra context:

{
"message": "Where is my order?",
"threadId": "support-chat-8412",
"metadata": { "userId": "U123" }
}

Pick a threadId per conversation (any stable string) and send the same one on every follow-up request; turns that share a thread id belong to one conversation. The trigger does not mint one for you, so a request that omits it starts a run whose start data has no thread id to key memory on. The request is answered immediately with {"message": "ok"}; the run happens in the background.

The turn arrives as the run’s start data, with the body under $start->payload beside the request’s method, URL, and headers. Read the message downstream with {{ $start->payload->message }} and the thread id with {{ $start->payload->threadId }}.

To give an Agent memory of the conversation, wire a Chat Thread node to its Memory handle and key the thread on the inbound thread id:

{{ $start->payload->threadId }}

An Agent in a flow that starts with Chat gets three tools for talking with the person on the other end, without wiring anything:

  • ask_user asks a question as a short form in the chat, and waits for the answer.
  • watch_run promises to report back on a run: when the run completes, fails or is stopped, a new turn of the conversation starts with what happened.
  • schedule_follow_up promises to come back at a time, up to 30 days ahead, with a note of what to do then.

To choose which of the three an agent gets, wire them to its Tools handle as nodes: Ask the Person, Watch a Run and Follow Up Later, starred at the top of the list when you click the agent’s Tools handle. Once any of them is wired, the agent gets only the wired ones. Until then the agent card says it gets all three from the trigger. Wired, they work in a run no conversation started too: there the agent’s run waits for the answer, the run or the time.

A conversation holds at most 10 of these promises at once. In the chat page in Publicus each one is listed under the message box with a Cancel button, and the turn it starts is marked as a follow-up rather than as something you typed. The Schedules page lists every waiting promise in the workspace, with a Cancel button too.

The Webhook / Chat template is the minimal chat loop: Chat trigger → Start → Transformer → LLM Chat. The Transformer shapes the turn into a prompt:

{!! json_encode(["userPrompt" => $start->payload->message]) !!}

and the LLM Chat node answers it.

  • The HTTP response acknowledges receipt only; it does not carry the reply. Read the reply from the run report, or have the flow deliver it through a channel node or an outbound request.
  • With withoutOverlapping on, a turn that arrives while a previous run of the flow is still in progress is skipped, not queued, and recorded as a receipt on the traffic log. For a busy conversational flow, switch it off so no turn is dropped.
  • maxHistory is stored with the node, but nothing reads it. How much of the conversation an agent sees is the recencyWindow on its Chat Thread memory node.