Skip to content
GuideAPIANT.aiv2

Chat widgets

View .md

How a chat widget automation receives visitor messages, replies through an AI agent that runs on your own Anthropic or OpenAI connection, calls tool automations, and embeds on your website.

A chat widget is a chat page that APIANT hosts for one automation. Every message a visitor sends starts a run of that automation, and the automation replies with the Send chat response action. The widget can open on its own page or float on your website through an embed script.

Build a chat widget

Describe the chatbot to Claude or the assistant, for example: "Build a support chat widget that answers questions about our return policy, and can look up an order status in Shopify when the visitor gives an order number."

A basic chat automation has three parts:

  1. The Chat message received (instant) trigger from the Chat app. The trigger data carries the visitor's message and a conversation_uuid.
  2. The AI Agent message action from the AI Agent app, which sends the message to a model and returns the model's Response.
  3. Send chat response, which posts the reply to that conversation.

When the automation is committed, Claude or the assistant returns the widget URL. Turn the automation on before you open it: a widget whose automation is off shows the message "This chat's automation is not turned on."

The widget page shows the chat title, the welcome message, the conversation and a message box.

The AI agent needs your model connection

AI Agent message calls Anthropic (the default provider) or OpenAI with an account you connect yourself. APIANT supplies no model key for this step, and a step with no connection fails with a message naming the app to connect. Connect Anthropic or OpenAI on the Connections page first; see Connecting accounts.

AI Agent message inputPurpose
MessageThe visitor's message
ModelThe model ID for the chosen provider
InstructionsThe system prompt for the agent
Conversation UUIDKeeps the conversation's history between messages. Map it from the trigger's conversation_uuid.
Provideranthropic (default) or openai
Web search, Vector store ID, Reasoning effort, VerbosityProvider options

The step fails, rather than replying, when the provider returns an error or the agent exceeds its tool-call limit.

Give the agent tools

The agent can call your tool automations: active automations that start with the Tool input (instant) trigger and end with Tool output. When the chat automation is in a dashboard folder, the agent sees only the tool automations in that same folder. When it is in no folder, the agent sees every active tool automation on your account. The automation's name, description and input help text are what the model reads to decide when to call the tool and what to pass, so ask Claude to write them precisely.

The same tool automations can also be exposed to external MCP clients, where folders do not matter. See Automations as MCP tools.

Other Chat actions

ActionUse
Save conversation memory, Recall conversation memoryStore and read a named value for one conversation, such as the visitor's email. Values are kept for about 60 days.
Await chat goal, Chat goal accomplishedHand the conversation to a separate goal automation (for example "get the visitor's email") and pause until that automation signals it is done
Get value from browserRead a query parameter from the page URL or a value from the browser's localStorage, for example a customer ID your site already knows
Transfer chat to automationMove the conversation to another chat automation's widget. The transfer is one-way, and the step must run in the chat automation itself, not in a tool automation.

Widget settings

Set these on the trigger. Ask Claude to change any of them.

SettingDefault
Chat titleChat
Welcome messageNone
Agent nameAPIANT Agent
Input placeholderType a message…
Header colorPlatform theme
Widget width, Widget heightResponsive default
Agent icon URL, Visitor icon URL, Send icon URLPlatform icons
Auto openOff
Response timeout (seconds)120
Timeout messageShown when no reply arrives within the timeout

Embed the widget on your site

Add one script tag to your page. The key is the last segment of the widget URL.

html
<script src="https://app.apiant.ai/webchat/embed.js?key=YOUR_WIDGET_KEY&widgetStyle=popout&widgetTabLabel=Chat%20with%20us"></script>

In popout style, the widget appears as a tab in a corner of the page and slides open into a chat panel.

ParameterValuesDefault
keyThe widget key (required)None
widgetStylepopout, header or footerpopout
widgetPlacementCorner for the popout, such as Right-Bottom or Left-TopRight-Bottom
width, heightPanel size in pixels400, 600
widgetDelaySeconds before the tab appears (popout) or the bar opens (header, footer)0
widgetTabLabelTab textClick to open
widgetTabColor, widgetTabLabelColor, widgetArrowColor6-digit hex without #F16E4E, FFFFFF, FFFFFF
widgetTabHeightTab height in pixels35
widgetTabIsSizedToTexttrue or falsetrue
domainHost that serves the widgetThe host the script was loaded from

To pass something your site knows about the visitor, add it as a query parameter on the page and read it in the automation with Get value from browser.

Testing

Chat runs start from real widget messages, so test by opening the widget URL and chatting. Each message appears in Execution history as a run.

Troubleshooting

SymptomCause and fix
The widget page says the chat's automation is not turned onThe chat automation is off. Turn it on.
No reply, then the timeout messageThe run failed or did not reach Send chat response. Open the run in Execution history, or ask Claude why it failed.
The run fails at AI Agent message naming an app to connectConnect your Anthropic or OpenAI account.
The agent never uses a toolThe tool automation is off, in a different folder from a chat automation that is in a folder, or has a vague name and description.
The agent step fails after many tool callsA tool automation keeps returning an error to the agent. Fix the tool automation.
A visitor who reloads the page after a transfer starts a new conversationExpected. The browser remembers one conversation per widget URL.

Next steps

Related docs

Last updated September 15, 2026