JavaScript API
Control the embedded chat widget from your own JavaScript
Once the snippet has loaded, window.LimioChat is available on the page. Use it to open chat from your own buttons, react to widget events, or switch identity in a single-page app.
Waiting for the widget
The snippet loads with defer, so LimioChat doesn't exist while your own early scripts run. Use the onReady callback:
<script>
window.LimioChatConfig = {
onReady: (chat) => {
document
.querySelector("#talk-to-sales")
.addEventListener("click", () => chat.open())
}
}
</script>Methods
open()
Opens the chat panel. With data-fab="never" this also loads the widget on first call.
close()
Closes the panel.
toggle()
Opens if closed, closes if open.
identify(jwt)
Switches to an identified session using a signed identity assertion. Restarts the conversation under the new identity. Returns a promise; rejects if the assertion is invalid.
logout()
Switches to a fresh guest session. Returns a promise.
destroy()
Removes the widget from the page and clears the stored session.
on(event, listener)
Subscribes to a widget event. Returns an unsubscribe function.
Events
ready
The widget has loaded and the API is usable
open
The chat panel opens, whether by the visitor or by open()
close
The chat panel closes
identityChanged
identify() or logout() completed; payload is { identity: "user" | "guest" }
Session storage
The visitor's chat session token lives in your site's localStorage under limio.chat.<api-host>.session. It lasts 24 hours and renews automatically. Clearing site data resets the visitor to a fresh guest. The token only grants access to that visitor's own chat conversation; it carries no other permissions.
Last updated
Was this helpful?

