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: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: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
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 installingwindow.centillion. Validate both its origin and its source. Use the iframe’s
actual app origin, including the port when testing locally.
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 initialoptionsChanged 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.