After adding the code snippet to your website, you will be able to use JavaScript functions available in the _xeno
object. That will bring you more control over your chatbox.
Ex: _xeno.identifyContact()
(Array) List of conversations and Messages
(Boolean) Whether the init function has been called or not
(Class) Used to instantiate new Messages.
new _xeno.Message(sample, text)
(Object) List of samples used to create a new message.
MessageSample.support
.agent
.visitor
.bot
Get an info from the contact.
infoName
(String) Key of the info to get from the contact
Get the public key used to initialize the chatbox.
Returns (String) The public key
Will show the previous view, as when the contact clicks on the "back" arrow.
Returns (Boolean) Whether the command was successful or not. If you can't go back any further, it will return false.
Triggers the initialization or re-initialization of the chatbox with the settings provided in
_xenoSettings
.
Used to know if the chatbox is in Live or in Delayed mode.
Returns (Boolean) True is the chatbox is in Live mode, false if the chatbox is in Delayed mode.
Used to know if the chatbox is open or closed. It can be changed using
_xeno.show()
and_xeno.hide()
. When the chatbox is going to be opened but it is not fully initialized yet (on page loading), it will returntrue
.
Returns (Boolean) Whether the chatbox is open or closed.
Attach event listeners to Xeno.
event
(String) Name of the event to listen to
callback
(Function) Function called when the event is triggered
Adds a Message to the current conversation (the conversation your contact is watching, or the last open conversation, or an empty one). The Message object has to be initialized first with new
_xeno.Message(_xeno.MessageSample.bot, "Hello World!")
. This object will then be used as an argument to thesendMessage
function. Note: This message is only displayed locally and is not sent to the server.
message
(Message) A _xeno.Message object
Simulates a message sent by the Contact. This message is displayed in the chatbox and sent to the server.
text
(String) Text that will be sent
callback
(Function) Callback for apps not supporting promises
Returns (Promise) Promise resolving with a Boolean telling wether the message could be sent or not
Shows the chatbox
Hides the chatbox
Updates current contact info and sends it to the server. Can be used to update their current page by specifying an
info.current_page
. Note: The Contact ID can't be changed here: The contact is still the same, but we have more or different info about them.
info
(Object) An object containing info about the contact. id
will be ignored. Will use current_page
to manually update their current page (useful for Single Page Apps).
options
(Object) Various options to alter the function behavior.
triggersCheck
(boolean) Automated communications are only checked upon page navigation. Since SPA do not trigger any standard page navigation after the initial page loading, automated communications will not be pushed anymore. This option will explicitly ask to perform a new check.
callback
(Function) A function called with the response from the server.
Changes the flow that will be ran when starting a new conversation. This won't affect ongoing conversations.
botTreeUuid
(string|number) The UUID of the flow you would like to run. You can find it on your flows list, by opening the "Advanced info" modal. This parameter also accepts a flow ID (which changes everytime you edit a flow), or a flow name (which will change when renaming your flows).
Opens the chatbox and displays an empty conversation.
options.botTree
(string|number) The UUID of the flow you would like to run. You can find it on your flows list, by opening the "Advanced info" modal. This parameter also accepts a flow ID (which changes everytime you edit a flow), or a flow name (which will change when renaming your flows).
options.contactCommitted
(boolean) Whether the contact performed an action stating explicitely that they want to start a new conversation. If you are using this function when the page loads, or on any non-user event, you should leave this parameter to a falsy value. When set to true
, the "Get started" button will be skipped, and the conversation will start right away.
When the chatbox is closed, incoming messages (automated communications, or manual messages) will display preview bubbles above the Xeno button used to open the chatbox. All these messages previews can be cleared by using the removeAllBubbles function. Note that clearing previews won't remove the corresponding messages inside the conversation once the chatbox is open.
Any automated communication, that is either being displayed or which is planned to be displayed a few seconds later will be removed or canceled.
Deprecated. Use
_xenoSettings
instead. This function allows to specify the identity of the visitor. Theid
is a unique ID that identifies the visitor.id
andname
are mandatory. For SPA: If the visitor has already been identified, calling this function will destroy the chatbox and load a new one. This is useful when the user signed in another account. This function is called automatically when using_xenoSettings
.
info
(Object) Information about the contact to identify. id
and name
are mandatory.
Deprecated. Use
_xenoSettings
instead. Starts the initialization of the chatbox. This function is called automatically when using_xenoSettings
.
publicKey
(String) You can find this key in the "deploy" page
options
(Object) Contains various options used upon initialization