Each listener will return a CustomEvent object with specific data nested in the event.detail object:
/*** Add an event listener to the chat widget* @functionon* @param{string} eventName - the event to listen for* @param{Function} callback - the function to call when the event is triggered* @returns{CustomEvent} - the event object with specific data in the event.detail object*/.on('loaded', (e:CustomEvent) => {console.log(e.detail) // the event data specific to WebChat})
For convenience, all events return the element upon which the event was fired within the detail object. For additional return values, see the descriptions below.
Supported events
'loaded' - fired when the WebChat widget has initialised.
Returns a 'loaded' property with a Boolean value:
loaded: true
'openStateChanged' - fired when the WebChat widget is opened or closed.
Returns a String value:
enumopenState { OPEN ='open', CLOSED ='closed'}return openState: openState.OPEN
'messageSent' - fired when the user sends a message.