Skip to main content
The website embed exposes window.centillion.addEventListener and window.centillion.removeEventListener. Use them to update your page, track conversation activity or connect your own analytics and CRM code.

Available events

Every callback receives { type, data }. Tool events cover your custom actions: server actions and registered website functions. Built-in actions such as live chat, procedures and suggested messages emit no tool events. Tool events arrive while the chat request is running. Inspect the result to determine whether an action succeeded. A call or result event alone does not confirm a successful purchase, booking or form submission. Greeting messages, conversation resets, errors and human handoff notices do not emit assistant-message. Restored history does not replay message events. Attachments travel with the chat request; user-message contains only the message text, which can be empty for a message containing only files. Dictation and sending are separate steps. Visitors can edit the transcript before sending, so the later user-message can contain different text. Dictation uses the browser’s speech recognition service and requires microphone access. The dictation control requires Voice to text (Dictation) in Display settings. Browsers without speech recognition show an explanatory message. In dictation-only mode, a completed transcript is sent automatically. Voice calls have a separate control and do not emit dictation-transcript.

Add and remove listeners

Run this after the embed script has loaded:
You can register several callbacks for an event. Registering the same callback twice adds it once. A failed callback does not stop the other callbacks or the chat. window.Centillion exposes the same listener methods, so existing identity integrations can keep their capitalized name. Listeners remain registered while the host page stays loaded, including when a published chat reloads after a reset. The new conversation emits its own message events; the reset and its greeting do not emit assistant-message. Listeners receive events from every Centillion widget loaded by the embed script on the page. For separate event streams per agent, use the iframe integration below and check each iframe’s contentWindow.

Register before the script loads

Queue calls before your existing embed script tag:
The loader replays queued calls in order. It loads the chat iframe when a visitor opens or approaches the launcher. The first optionsChanged event therefore waits for the iframe to load, even though the JavaScript API is already available. Use a current snippet from Channels → Install → Website widget if your browser has cached an older loader.

React cleanup

Load the embed before mounting this component, or use the queued call form for both registration and removal. Remove listeners on unmount or route changes.

Runtime options

setOptions merges valid fields into the current overrides. resetOptions() clears all overrides. To clear selected fields, pass an object whose values are true. Overrides last for this page load and never change dashboard settings.
Unknown keys and invalid values are skipped with a console error; valid fields in the same call still apply. Values are never truncated. Clearing an override removes that key from event.data.options. Setting the same overrides again does not emit a change event.

Plain iframe integration

A plain iframe posts the same events to its parent without installing window.centillion. Validate both its origin and its source. Use the iframe’s actual app origin, including the port when testing locally.
Register the parent listener before assigning the iframe’s src when creating it dynamically. Wait for centillion:events-ready before posting commands. resetOptions uses { type: "resetOptions", params: { footer: true } }; omit params to clear everything. With a referrer-free iframe, this handshake also establishes the parent origin before any conversation content is posted. The handshake repeats when a published chat reloads after a reset. Keep the parent listener active and resend runtime options on each centillion:events-ready event, as the example does. The JavaScript embed script reapplies its saved runtime overrides automatically.

Check your integration

Open the chat and confirm the initial optionsChanged event. Send a question; expect one user-message followed by one assistant-message. Trigger a test action and match its call ID with the result. Dictate, then edit the draft before sending to verify the transcript and sent-message events differ. Change an option and check that its new value is visible when your callback runs. Reset one field, then all fields. Finally, remove a named callback and confirm that it stops receiving events. If events are missing, check the exact event name, the browser console, whether the iframe loaded, and whether your origin check includes the correct scheme and port.
Last modified on October 20, 2026