Skip to main content

Widget configuration

This is the developer reference for the embeddable chat widget. It lists every initialization parameter, the methods you can call to control the widget from your page, the custom events the agent can push to your page, and the browser storage keys the widget uses.

For the task of switching the widget on, configuring its appearance, and embedding it on your site, see Web Widget. The parameters below are passed as properties of the object you give to BotChatWidget.createBotChat({ ... }). The generated snippet already contains the required ones; add the rest as needed.

Required parameters

ParameterTypeDescription
botRoutestringThe agent's endpoint URL. Taken from the generated snippet.
authorizationTokenstringThe agent's widget token. Taken from the generated snippet.

Core settings

ParameterTypeDefaultDescription
elementIdstring'chat-widget'ID of the container element. Use different IDs to place several widgets on one page.
isFloatingBtnbooleanfalseFloating button (true) or embedded (false).
version'v1' | 'v2'Operation mode. See Operation modes.
multiAgentbooleanfalseMulti-agent mode for v2. Ignored on v1.
timezonestringbrowser timezoneIANA timezone for timestamps, for example 'Europe/Madrid'.

Customer context and user identity

Pass customer details at initialization so sessions are tied to a known person.

ParameterTypeDefaultDescription
userIdstring''Customer identifier from your system.
userNamestring''Customer display name.
emailstring''Customer email.
phonestring''Customer phone number.
tenantIdstringTenant identifier for multi-tenant installations.
kwargsobjectCustom variables passed when a session starts. Keys that start with _ are not logged and are not passed into the agent's prompt — use the underscore prefix for tokens and other secrets.

How userId is resolved:

  • If you pass a userId (for example, the logged-in user's ID from your backend), the widget uses it. In v2 mode this is what lets a customer continue earlier sessions across visits and devices.
  • If userId is empty, the widget generates an anonymous ID and stores it in the browser's localStorage. The same browser keeps the same identity; clearing site data resets it. See Browser storage keys.

Appearance and behavior

ParameterTypeDefaultDescription
theme'light' | 'dark''light'Widget color theme.
primaryColorstringPrimary accent color (hex).
headerTitlestring'Chat with the Agent'Header title text.
headerTitleColorstringHeader title color.
showHeaderbooleanShow or hide the chat header in embedded mode.
avatarUrlstring''URL of a custom agent avatar image.
showAgentAvatarbooleanfalseShow the agent avatar next to its messages.
showAiBotTimestampbooleanfalseShow timestamps on AI messages. Timestamps are always shown for customer and human-operator messages.
usePlainChatbooleantruePlain, bubble-less message design.
reactionsbooleantrueThumbs up/down reactions on agent messages.
showPoweredBybooleantrue"Powered by" footer. The portal-generated snippet sets this to false.
forceMobileLayoutbooleanForce the mobile layout regardless of screen size.
flametreeIconVariant'static' | 'animated'Variant of the default widget icon.

Floating button

These options apply only when isFloatingBtn is true.

ParameterTypeDefaultDescription
floatingBtnSizenumber58Button size in pixels.
floatingBtnMobileSizenumber58Button size on mobile.
floatingBtnIconShape'circle' | 'square''circle'Shape of the default icon.
floatingBtnIconBackgroundColorstringBackground color of the default icon.
floatingBtnClosedIconColorstringStroke/fill color of the default icon.
floatingBtnClosedIconUrlstring''Custom icon image URL for the closed state.
floatingBtnOpennedIconUrlstring''Custom icon image URL for the open state.
floatingBtnIconClosedSizenumber32Closed-state icon size.
floatingBtnIconOpenedSizenumber32Open-state icon size.
floatingBtnMarginBottomnumber8Offset from the bottom edge of the page.
floatingBtnMarginRightnumber16Offset from the right edge of the page.
floatingBtnMobileMarginBottomnumber8Offset from the bottom edge on mobile.
floatingBtnMobileMarginRightnumber16Offset from the right edge on mobile.
tooltipTextstring''Tooltip text shown next to the button.
openByDefaultbooleanfalseAuto-open the chat on page load.
openByDefaultDelaynumber3000Delay before auto-open, in milliseconds. Minimum 1000.

Voice playback

ParameterTypeDefaultDescription
voiceOverbooleanfalseEnable text-to-speech for agent replies.
showVoiceOverbooleanfalseShow the Voice over toggle in the widget. Keep false if you prefer manual playback with the speaker icon on each message.
disableStreamingTtsbooleanfalseSynthesize the full reply in one pass instead of streaming chunks. Enable if you hear audible seams between chunks.

Voice message recording is enabled with the Allow voice messages setting on the agent page, not a widget parameter.

Sessions and input

ParameterTypeDefaultDescription
showStartNewSessionBtnbooleanfalseShow a Start new conversation button next to the input. It closes the current session and starts a fresh one.
disableSendingMessageWhileAwaitingResponsebooleanfalseBlock the input while the agent is composing a reply.
onError(error) => voidError callback.
messageListenersarrayCallbacks that observe chat message events. See Message listeners.

Operation modes

ModeSettingsBehavior
Standardversion: 'v1'A new session on every page load; no history retrieval.
Session managementversion: 'v2', multiAgent: falseThe widget looks up the customer's active sessions by userId and continues the matching one; otherwise it creates a new session.
Multi-agentversion: 'v2', multiAgent: trueShows all of the customer's active sessions and an agent selection screen; the customer can switch between agents.

multiAgent has no effect on v1.

Control methods

After initialization, control methods are available on window.BotChatWidget. The controller object returned by createBotChat exposes the same methods plus a ready promise you can await before calling them.

window.BotChatWidget.openChat();
window.BotChatWidget.openSession(sessionId);
window.BotChatWidget.updateSession({ env_info: { customKey: 'value' } });
window.BotChatWidget.runAction('text');
window.BotChatWidget.startNewSession();
MethodSignatureWhen to use
openChat()openChat(): voidOpen the chat window from your own UI — a "Chat with us" button, an onboarding step, an exit-intent prompt. Use this instead of simulating clicks on the floating button.
openSession(sessionId)openSession(sessionId: string): voidJump to a specific session (v2 modes).
updateSession(data)updateSession({ env_info: { ... } }): voidUpdate the running session's custom variables — for example, refresh an auth token you originally passed in kwargs.
runAction(text)runAction(text: string): voidSend an action message into the chat on the customer's behalf, for example to start a specific scenario when they click a page element.
startNewSession()startNewSession(): voidClose the current session and start a fresh one, for example after the customer logs out.

The ready promise

To call a method as soon as the widget is ready, await the ready promise on the controller returned by createBotChat.

const widget = BotChatWidget.createBotChat({
/* ...options... */
});

document.querySelector('#contact-us').addEventListener('click', async () => {
await widget.ready;
widget.openChat();
});

Custom events

The agent can push events to the host page over the widget's WebSocket connection — useful for firing conversion or analytics events when the conversation reaches a milestone. The agent sends a message of this shape:

{ "type": "custom", "provider": "string", "event": "string", "data": {} }
  • provider selects the client-side handler.
  • event is the event name; data carries optional payload fields.

The widget ships handlers for two providers:

providerWhere the event goes
GooglePushed to the page's dataLayer, where Google Tag Manager and Google Analytics pick it up.
MetaSent to the Meta Pixel as a custom event (fbq('trackCustom', ...)), when the pixel is present on the page.

Events with any other provider value are ignored.

For example, an agent could send the following when a visitor leaves their contact details:

{
"type": "custom",
"provider": "Google",
"event": "lead_captured",
"data": { "plan": "pro" }
}

Message listeners

To observe raw chat message events yourself, pass an array of callbacks in the messageListeners option. Each callback receives one chat message object as it is added to the conversation.

BotChatWidget.createBotChat({
/* ...options... */
messageListeners: [
(message) => {
console.log('chat message', message);
},
],
});

Browser storage keys

The widget stores a small amount of state in the browser. Clearing site data resets all of it.

KeyStoragePurpose
flametree-widget-userId-v2localStorageAnonymous customer ID, generated when no userId is passed (v2). The same browser keeps the same identity.
unreadConversationslocalStorageArray of unread conversation IDs.
${botRoute}-sessionIdsessionStorageThe current session ID for this tab, used to resume the session on reload.
  • Web Widget — switch on, configure, and embed the widget
  • Channels — create, manage, and attach connections
  • Sessions — every conversation, whatever its channel

Was this article helpful?