Widget JavaScript API

The embed script defines window.meetmydesk (also available as window.chatbase, so existing code keeps working). Everything is safe to call before the widget has finished loading.

Calling before it has loaded

Commands issued before the script finishes are queued and run in order. For the async snippet pattern, define a stub first:

Bubble and side panel on one page

With both on a page, meetmydesk.open() and toggle() act on the bubble (or on the panel if there is no bubble); close(), setOptions(), identify(), resetUser() and event listeners reach both. To reach one directly use meetmydesk.bubble or meetmydesk.panel, for example meetmydesk.panel.open(). Each event carries a source of bubble, center or panel.

Methods

Options

Each option also has a setter: setDisplayName, setBubbleText, setFooterText, setMessagePlaceholder, setDismissibleNotice, setInitialMessages, setSuggestedMessages, setOrbColors, setVoiceMode.

Inside an iframe

If you embed /embed/AGENT_ID in your own iframe there is no window.meetmydesk. Send postMessage({ meetmydesk: 1, type, params }, origin) with the same command names, and wait for the iframeReady message before sending.