Commands (postMessage)
Control the widget using window.postMessage. These commands are stable and recommended for most integrations.
Open / Close
// open
window.postMessage({ type: 'WIDGET_OPEN' }, window.location.origin)
// close
window.postMessage({ type: 'WIDGET_CLOSE' }, window.location.origin)
Minimize / Unminimize
// minimize
window.postMessage({ type: 'WIDGET_MINIMIZE' }, window.location.origin)
// unminimize
window.postMessage({ type: 'WIDGET_UNMINIMIZE' }, window.location.origin)
CTA hover label
// show CTA hover label
window.postMessage({ type: 'BUTTON_HOVER_OPEN' }, window.location.origin)
// hide CTA hover label
window.postMessage({ type: 'BUTTON_HOVER_CLOSE' }, window.location.origin)
Helper (recommended)
Use a tiny helper to reduce repetition:
const WIDGET_TARGET = window.location.origin
const send = (type, payload) =>
window.postMessage({ type, payload }, WIDGET_TARGET)
// examples
send('WIDGET_OPEN')
send('WIDGET_MINIMIZE')