These commands keep working, but the Window API methods (open(), close(), expand(), minimize()) do the same with promises, error codes and events, and are recommended for new integrations.
Open / Close
JavaScript
// open
window.postMessage({ type: 'WIDGET_OPEN' }, window.location.origin)
// close
window.postMessage({ type: 'WIDGET_CLOSE' }, window.location.origin)Minimize / Unminimize
JavaScript
// minimize
window.postMessage({ type: 'WIDGET_MINIMIZE' }, window.location.origin)
// unminimize
window.postMessage({ type: 'WIDGET_UNMINIMIZE' }, window.location.origin)CTA hover label
JavaScript
// 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:
JavaScript
const WIDGET_TARGET = window.location.origin
const send = (type, payload) =>
window.postMessage({ type, payload }, WIDGET_TARGET)
// examples
send('WIDGET_OPEN')
send('WIDGET_MINIMIZE')