LiveChatWidget object available on your page.
Before you start
The API is available through the globalLiveChatWidget object initialized by the widget installation code. If the widget isn’t installed on your website, copy the code from website settings or use the snippet below. Replace <ORGANIZATION_ID> with your organization ID.
Text widget code
API functions
TheLiveChatWidget object provides five functions:
onregisters a callback for an event.onceregisters a callback for one occurrence of an event, then removes it.offremoves a callback registered withon.callinvokes a method or setter.getretrieves data from the widget.
John Doe:
Asynchronous initialization
By default, the widget loads when the installation code runs. To load it after an interaction or another event in your website, setwindow.__lc.asyncInit to true before the rest of the installation code.
LiveChatWidget object, but it doesn’t load the widget resources or trigger the ready callback.
Call LiveChatWidget.init() when you want to load the widget:
Chat Widget methods
The reference separates the API by how you interact with the widget.Related APIs
For a broader comparison, see Chat Widget APIs.