Skip to content

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.


Opens the chat widget.

window.chatbotiq('open');

If the widget is already open, this does nothing.


Closes the chat widget.

window.chatbotiq('close');

If the widget is already closed, this does nothing.


Toggles the widget open or closed.

window.chatbotiq('toggle');

Returns the current state of the widget.

const state = window.chatbotiq('getState');
// Returns: 'open' or 'closed'

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.