Skip to main content
The website embed script exposes window.centillion. Use it to connect your own buttons to the chat or change its presentation for the current page. Use the snippet from Channels → Install → Website widget, with embed.js?v=10 or newer.

Open, close and reset

close() preserves the conversation and unsent text. resetChat() clears the conversation, draft and attachments, ends any active voice call, and starts a new session. It preserves the visitor’s identity and runtime overrides, including custom initial messages. It does not delete stored conversation records or tickets. A published conversation stays on the release where it started. Resetting it reloads the chat iframe and starts a conversation using the current release traffic allocation, including that release’s saved greeting and appearance. The embed script reapplies runtime overrides after the iframe reloads. If A/B testing excludes the visitor, open(), auto-open and runtime options leave the widget hidden. Resetting the chat does not change the visitor’s assignment. Use 100% or disable testing in Display → A/B testing to include every visitor while checking your controls.

Open with a message

The chat opens and sends the message. Messages must be non-empty strings of at most 12,000 characters. Only one message can be in progress at a time. For proactive help, hide the prompt until an answer arrives:
The prompt stays in the agent’s conversation history but is hidden from the visitor. A closed bubble opens when the answer becomes available. Closing or resetting the bubble while waiting cancels that automatic opening. Failed requests leave the bubble closed and emit an error event. hideMessage has no effect without message.

Runtime options

All fields are optional. Overrides affect this page load only. They never save changes to your agent. Reloading the host page clears them. Invalid fields log a console.error and leave their previous values intact. Valid fields in the same call still apply. setOptions() rejects oversized values instead of truncating them.

Reset overrides

Resetting options does not reset the conversation. Runtime-only options revert to their defaults. Changes to initial messages appear in the next fresh chat if a conversation has already started.

Individual setters

Each setter behaves like setOptions() for that field, with one exception. setInitialMessages() truncates the array’s text to 1,000 characters in order. setOptions({ initialMessages }) rejects an oversized array. Both methods write the same override, so the last valid call wins.

Dictation and voice calls

Dictation uses the browser’s speech recognition, separate from a live voice call with the agent. Enable Voice to text (Dictation) under Display. Visitors start recording themselves and grant microphone permission. In the normal composer, the transcript goes into the message box for review. With dictationOnly: true, stopping dictation sends it as a chat message. Browser speech recognition support varies. Unsupported browsers show “Dictation is unavailable in this browser.” They can still use the normal text composer unless you hide it with dictationOnly. Microphone permission errors appear beside the dictation button. Inline frames need allow="microphone". A reset discards unfinished dictation and releases the microphone.

Events

Every callback receives { type, data }. Register listeners before the operation you want to observe. Reapplying an unchanged value emits no change. Updates React renders together produce one optionsChanged event with the resulting overrides. Hidden prompts are visible to your event listeners. Avoid writing sensitive message content to analytics or console logs.

Reset after inactivity

Give visitors time to read the final response before resetting. For a reset after a booking or another action, listen for tool-result, check event.data.name and event.data.result, then schedule the reset.

Custom buttons and navigation

Debounce repeated message triggers, and respect a visitor’s dismissal instead of immediately reopening the bubble.

Calls before the script loads

The API queues controls while its settings and iframe load. If your application runs before the embed script itself, install this queue first:
After loading, both centillion("open", options) and centillion.open(options) work. Existing centillion("registerTools", tools) and the separate Centillion("identify", identity) API keep working. Use one agent’s embed script per page.

Plain iframe controls

Without the embed script, window.centillion does not exist. Wait for the iframe’s iframeReady event, then post controls to its origin. Verify both the sender window and origin before handling responses.
Use the same method names for type, and the method argument for params. For example, post { type: "resetChat" } to reset, or { type: "open", params: { message: "Help me choose a plan" } } to send a message. close hides the chat content, and open shows it again. The parent page owns the inline iframe’s size and placement, including the space left when hidden. Register the message listener before assigning the iframe’s src or inserting it into the page so you do not miss readiness. Messages sent before readiness are not queued by a plain iframe. A published chat reset reloads the iframe. Keep handling each iframeReady event and resend your options after every reload. The listener above stays on the host page and reapplies dictationOnly to the new conversation.
Last modified on October 20, 2026