/
Messenger Events

Messenger Events

This section describes events fired by the Messenger element. Further events might be added in the future based on requirements.

“send2crmMessengerToggled” event

An event is triggered when the Messenger element is toggled. The event allows the host website to appropriately react to the state change.

The following data is available on the event.detail object:

{ isExpanded: Boolean // Whether or not the Messenger element is expanded }

Example implementation:

const messenger = document.querySelector("send2crm-messenger"); messenger.addEventListener("send2crmMessengerToggled", (e) => console.log(`Messenger is ${e.detail.isExpanded ? "expanded" : "collapsed"}`), );