When running Xeno on your website, various events will be fired, allowing you to react to these events.
Here are two examples:
document.addEventListener('xeno.open', function (event) {
console.log('Chatbox opened by ' + event.detail.by);
}, false);
_xeno.on('open', function (details) {
console.log('Chatbox opened by ' + details.by);
});
The event will contain a details property which contains additional information about the event.
When a conversation is initiated from the chatbox and a flow is started.
{ 'conversation_id': 123456, 'bot_tree': { 'id': 1234, 'uuid': '31ae5f74-a606-4780-9021-2d69688108c5' } }
When the chatbox is closed
{ 'by': 'new_message' }
in ['user', 'external_link', 'new_message', null]
When the contact booked a meeting
{ 'date': [Date Object], 'name': 'Rémi D.' }
When the chatbox is open
{ 'by': 'new_message' }
in ['user', 'external_link', 'new_message', null]
When the chatbox is loaded and connected to the backend
{ 'online': true }
in [true, false]
When the contact has received a message. Some messages not generated by the chatbox but sent using the identity of the contact will fall into this event, and have the "from" field equal to "me".
{ 'message': 'Hello', 'from': 'Rémi D.' }
When the contact has sent a message
{ 'message': 'Hello', 'from': guest_id }
When the topbar is removed from the page.
{ }
When the topbar size has changed (generally, because the viewport has been resized).
{ 'height': 35 }
When the topbar appreas on the top of the page.
{ 'height': 35 }