Skip to content

Widget API

Option Data attribute Default
endpoint data-endpoint required
publishableKey data-key required
token data-token none (a guest)
channel data-channel web
locale data-locale <html lang>, then the browser
Title data-title from Appearance
color data-color from Appearance
position data-position from Appearance, then right
open data-open="true" closed
expanded data-expanded="true" / "false" the shopper’s last choice, then Appearance
mode data-mode="app" none; app = always open, full page, no launcher, ✕ emits close (used by the app page)
tools — (mount() / React only) handlers for client tools, by name
onToolCall — (mount() / React only) callback after every client tool call (same payload as the tool event)
onAddToCart — (mount() / React only) ({ product, quantity, toolCallId? }) => void | Promise: adds to your cart from the round button on product cards (see Host callbacks); without it, or an addToCart client tool, the button opens the product
onFeedback — (mount() / React only) callback when a shopper rates an answer with the thumbs (same payload as the feedback event)
describeApproval — (mount() / React only) ({ toolName, input, locale }) => string | { title, detail? } | undefined: visitor-facing wording for the approval card; return nothing for the default card
Method Does
open(), close() Opens or closes the chat
expand(), collapse(), toggleExpand() Full-screen mode
setToken(token | null) Signs a customer in or out, see Signed-in customers
setContext(object) Page context sent with every message, e.g. { page: 'cart' } (signed token keys win for signed-in visitors)
registerTool(name, fn), registerTools({…}), unregisterTool(name) Serve client tools from this page
sendMessage(text) Sends a message as if the visitor typed it and opens the chat
setLocale(tag) Changes the chat’s language
on(event, fn), off(event, fn) Listen to events
destroy() Removes the chat from the page
Event Payload Also on window as
action { action, component, payload?, product?, forwardTo? } helpvane:action
navigate { url, source } (source: link or assistant) helpvane:navigate (cancelable)
addToCart { product, quantity, toolCallId? } when the cart button on a product card is pressed; listening turns the button into “add to cart” helpvane:addToCart
feedback { messageId, rating: 'up' | 'down', text } when a shopper rates an answer helpvane:feedback
status { status: 'escalated' | 'solved' | 'closed', data } helpvane:status
close {} (app mode only) helpvane:close
signin {} (app mode only, “Sign in” pressed) helpvane:signin
tool { toolName, toolCallId, input, status, result?, error?, durationMs } after a client tool call helpvane:tool

See Host callbacks for the cart button on product cards and other actions.

Key Holds
localStorage['helpvane:session'] The guest’s chat session
localStorage['helpvane:expanded'] The full-screen choice

Both are functional storage needed for the chat to work; they contain no tracking.