The hosted script exposes one public initializer: window.initKommanderChatbot. Load https://app.kommander.ai/chatbot.js, then call the initializer after the script has finished loading.

Public Initializer

window.initKommanderChatbot(options: KommanderWidgetInitOptions): void | Promise<void>;
type KommanderWidgetInitOptions = { userId?: string; organizationId?: string; trialMode?: boolean; forceReset?: boolean; preloadSettings?: Record<string, unknown>; userData?: Record<string, unknown>; identity?: { id: string; email: string; userHash: string; }; audience?: string; timer?: boolean; timerEnabled?: boolean; containerId?: string; display?: 'floating' | 'page'; language?: string; };

Options

OptionUse
userIdLoads a personal assistant. Use the value shown in the embed snippet.
organizationIdLoads an organization-owned assistant. Prefer this for team workspaces when provided.
containerIdMounts into a custom container ID. Defaults to kommander-chatbot.
forceResetUnmounts and remounts an existing widget instance. Use when visitor identity changes.
userDataNon-secret analytics and routing attributes.
identityServer-generated signed visitor identity.
audienceThe visitor’s knowledge audience, such as 'licenza-movolab'. Answers use the shared knowledge plus the documents and FAQs tagged with this audience in Training; without it, only shared knowledge is used. It selects content, it is not access control: never tag secret documents.
timerEnabledShows response latency timing when enabled.
timerBackward-compatible alias for timerEnabled: true.
displayfloating (default) shows the chat bubble. page fills the containerId element, always open, with the visitor’s conversations in a sidebar.
languagePins the widget to one language, such as your page’s locale ('it', 'en'). It replaces the browser language, the dashboard language and the guess from the visitor’s first message. For replies to follow it too, turn off Automatic language detection in Settings. Unsupported codes are ignored.

Full-Page Chat

Use display: 'page' for a dedicated assistant page in your app. Give the container the height it should fill:

<div id="assistant" style="height: calc(100vh - 64px)"></div> <script> window.initKommanderChatbot({ organizationId: 'YOUR_ORGANIZATION_ID', containerId: 'assistant', display: 'page', forceReset: true, }); </script>

Only one widget instance runs per page, so a single-page app that shows the floating bubble elsewhere calls the initializer again with forceReset: true when entering and leaving the assistant page.

preloadSettings and trialMode are used by Kommander.ai preview surfaces. Production embeds should normally rely on saved settings loaded by the widget.

Lifecycle

  1. The script resolves its own origin from the script URL.
  2. The initializer loads React when needed.
  3. The widget stylesheet is injected once as kommander-style.
  4. The target container is found or created.
  5. The widget mounts into the container.
  6. Conversation ID, anonymous end-user ID, and selected local state are kept in browser storage.
  7. Messages are submitted to Kommander.ai and assistant updates are retrieved by polling.

Single-Page Apps

Initialize the widget from a root shell or layout that persists across route changes.

const WIDGET_CONTAINER_ID = "kommander-chatbot"; export function mountWidget(identity?: KommanderWidgetInitOptions["identity"]) { window.initKommanderChatbot?.({ userId: "YOUR_KOMMANDER_USER_ID", containerId: WIDGET_CONTAINER_ID, identity, forceReset: Boolean(identity), }); }

Do not call the initializer on every client-side route change. If a route change only changes the URL, the existing widget can stay mounted.

State Changes

ChangeRecommended handling
Anonymous visitor signs inFetch signed identity from your backend, then call with forceReset: true.
Visitor signs outCall with forceReset: true and omit identity.
Visitor switches accountFetch a new signed identity and call with forceReset: true.
Theme or color changes in Kommander.aiReload the host page to validate the saved widget settings.
Host route changesKeep the widget mounted unless the assistant context must change.

Limits

The widget does not expose public methods for open, close, sendMessage, or reading conversation messages. Use product settings, customer-data connectors, callback request automation, and Kommander.ai APIs for supported integration points.