JavaScript Widget API Reference
Control the ChatbotIQ widget programmatically using the window.chatbotiq function. This API is available as soon as the embed script is on your page — you don’t need to wait for the widget to finish loading.
Methods
Section titled “Methods”chatbotiq('open')
Section titled “chatbotiq('open')”Opens the chat widget.
window.chatbotiq('open');If the widget is already open, this does nothing.
chatbotiq('close')
Section titled “chatbotiq('close')”Closes the chat widget.
window.chatbotiq('close');If the widget is already closed, this does nothing.
chatbotiq('toggle')
Section titled “chatbotiq('toggle')”Toggles the widget open or closed.
window.chatbotiq('toggle');chatbotiq('getState')
Section titled “chatbotiq('getState')”Returns the current state of the widget.
const state = window.chatbotiq('getState');// Returns: 'open' or 'closed'Command queuing
Section titled “Command queuing”The API works even before the widget finishes loading. Commands are automatically queued and executed in order once the widget initializes.
This means you can safely call the API immediately after adding the embed script:
<script> // This works even if the widget hasn't loaded yet window.chatbotiq('open');</script>For practical use-case patterns (custom buttons, page triggers, keyboard shortcuts, SPA integration), see Control the Widget with JavaScript.
Related
Section titled “Related”- Control the Widget with JavaScript — practical how-to guide
- Embed the Widget — adding the widget to your site
- How the Widget Loads — understand the async loading lifecycle