Javascript Events

Javascript Events

Última actualización lunes, jun 27, 2022

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.


Events list

bot_tree_started

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' } }

close

When the chatbox is closed

{ 'by': 'new_message' } in ['user', 'external_link', 'new_message', null]

meeting_booked

When the contact booked a meeting

{ 'date': [Date Object], 'name': 'Rémi D.' }

open

When the chatbox is open

{ 'by': 'new_message' } in ['user', 'external_link', 'new_message', null]

ready

When the chatbox is loaded and connected to the backend

{ 'online': true } in [true, false]

received_message

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.' }

sent_message

When the contact has sent a message

{ 'message': 'Hello', 'from': guest_id }

topbar_hide

When the topbar is removed from the page.

{ }

topbar_resize

When the topbar size has changed (generally, because the viewport has been resized).

{ 'height': 35 }

topbar_show

When the topbar appreas on the top of the page.

{ 'height': 35 }

Javascript API

12 artículo en esta categoria.