Open the chat programmatically with the widget API

Wire your own buttons to the chat panel.

C
ChatteringJuly 27, 2026

The widget exposes a small JavaScript API so you can open the chat from your own buttons, links or product tours instead of waiting for someone to click the launcher.

The API

Once the script is on the page it exposes three methods:

  • window.Chattering.open() — opens the chat panel
  • window.Chattering.close() — closes it
  • window.Chattering.toggle() — switches between the two

Safe to call early

Calls made before the widget finishes loading are queued and fire once it is ready, so you do not need to check whether it has loaded.

Example

const button = document.querySelector('#chat-with-us');
button.addEventListener('click', () => window.Chattering.open());

Give any button on your page the id chat-with-us and clicking it opens the chat.

Need more help? Browse all articles or ask the assistant in the chat — it answers from these docs and can connect you with the team.

Was this helpful?

Related articles

Open the chat programmatically with the widget API | Chattering Help Center | Chattering.ai