▸ addListener(event, listener): void
addListener can be used to install an event listener in order to be able react to the widget internal events.
// listen to when a conversation starts
const listener = (payload) => console.log(payload);
_dixa_.addListener('on-conversation-started', listener);| Name | Type |
|---|---|
Event | properties of HostNotificationEvents |
| Name | Type | Description |
|---|---|---|
event | Event | is the event you wish to listen to |
listener | (payload: HostNotificationEvents[Event]) => void | is the callback function you register for this event |
void
▸ removeListener(event, listener): void
removeListener can be used to remove an event listener in order stop listening to that particular event.
// stop listening to conversation-started events
const listener = (payload) => console.log(payload);
_dixa_.removeListener('on-conversation-started', listener);void
▸ invoke(method, payload): void
init method. Once called, the widget iframe will be added to the DOM, the widget will be initialized and the toggler will show up (if it is not disabled in the payload).
The payload can be used to customize the initialization behavior, for example it is possible to hide the default toggler button setting the hideToggler property to true:
_dixa_.invoke('init', {
messengerToken: '[YOUR_MESSENGER_TOKEN]',
hideToggler: true,
});You can find all the options in the Commands page.
void