Web widget
Web widget JavaScript API
Open, close and remove the widget from your own code.
Use these to open the chat from your own buttons, for example with data-hide-launcher="true".
Open and close
The loader exposes window.MentioraWidget once it has run:
JS
window.MentioraWidget.open();
window.MentioraWidget.close();
window.MentioraWidget.toggle();
window.MentioraWidget.destroy(); // removes the launcher and the iframeOpen from any element
Any element with a data-mentiora-open attribute opens the chat when clicked, including elements added after the loader ran:
HTML
<button data-mentiora-open>Chat with us</button>Startup errors
If the widget fails to start, the loader removes itself and dispatches a mentiora:widget-error event on window:
JS
window.addEventListener("mentiora:widget-error", (event) => {
console.warn(event.detail.code); // "boot_failed"
});Identity commands
mentiora("identify", …) and mentiora("logout") sign users in and out. See Identify users.