- Documentation
- Workflows
- Triggers
- Chat
- The Chat trigger
The Chat trigger
The Chat message received trigger starts one workflow run for each message a visitor sends to a chatbot, and sends the workflow's reply back.
What the Chat trigger is
The Chat trigger is named Chat message received. It connects a workflow to a chatbot: every message a visitor sends to that chatbot starts one run of the workflow. The run ends with a Respond node, and whatever that node returns is shown to the visitor as the reply.
The trigger has one setting: the chatbot it answers. What the chat says first, how it looks, and where it is shared are set on the chatbot, not on the trigger. See How chatbots work.
The trigger is listed only where your workspace can hold a request open until the workflow replies. If Chat message received is missing from the trigger list, that capability is off for your account.
Pick the chatbot
Add the trigger
Open a workflow in the editor and click Start. Switch to the System tab and click Chat message received, listed in the Webhook group.
Pick a chatbot
In the trigger's panel, click Search chatbots… and pick a chatbot from the list. Each one is marked "(live)" or "(draft)".
Or create one
Click New chatbot at the bottom of the list to create a draft chatbot and pick it in one step. Type a name first to give it that name.
The panel then shows the chatbot's name, its status, and its client, with two actions:
- Open chatbot opens the chatbot's builder in a new tab, where you set what it says and publish it.
- Change clears the pick so you can choose another chatbot.
The fastest way to get all of this at once is Create workflow in the chatbot builder, which makes the three-node workflow below and picks the chatbot for you. See the chatbot quickstart.
The three-node recipe
Most chat workflows are the same three nodes in a row.
| Node | What it does |
|---|---|
| Chat message received | Starts a run for each visitor message. |
| AI Agent | Reads the message and writes an answer, using the tools you give it. |
| Respond | Sends the agent's answer back to the visitor. |
The AI Agent needs one more thing to hold a conversation: memory. Without it, every message is answered as if it were the first.
Add a Memory sub-node to the AI Agent
On the agent, click + on the Memory port, open the Memory sub-node, and turn on Remember the conversation.
Leave the suggested field in place
Under a Chat trigger the panel reads Remembering per: Chat visitor. That is the visitor's session,
$trigger.sessionId, so each visitor gets a separate memory and nobody sees another visitor's conversation.Map the agent's answer into the Respond node
Set the Respond node's Content type to
textand use the agent's answer as the body, or keepjsonand map the answer to a field namedreply.
What your workflow receives
Each run's $trigger has three fields:
{
"message": "Do you open on Sundays?",
"sessionId": "0b9f6c1e-6f0a-4c56-9d0e-0f3d2a8f5b11",
"metadata": {
"source": "embed",
"pageUrl": "https://www.example.com/pricing",
"locale": "en-US"
}
}sessionId stays the same for every message in one visitor's conversation. It is created for the visitor, who cannot choose or change it, which is what makes it safe to key memory on. The fields under metadata come from the visitor's browser and are hints only. The reference describes each one.
When the workflow answers
Two things must be true for visitors to get replies:
- The workflow is published.
- The chatbot is Live.
A published workflow whose chatbot is still a draft answers nobody, because visitors cannot reach a draft chatbot. The panel says so: "This chatbot is a draft. Open it to publish."
Where to see conversations
Each message is its own run in the workflow's run history, listed with the Webhook label. Open a run to see the message, the session, and the reply the workflow sent. There is no separate inbox or transcript view.
Next steps
- Chat trigger reference
- Create a chatbot and put it on a website
- Chatbot reference for the builder, sharing, limits, and visitor messages
- Remember the conversation (AI Agent memory)