Website SDK events
Alhena AI chat sdk emits the following js events, that can be used to customize the user experiences.
You can use the window.gleenWidget.on(eventName, callback
function to subscribe to these events.
See Website SDK JavaScript APIs for more details
widget:opened - This is called when widget successfully get opened
widget:closed - This is called when the widget successfully get closed
widget:loaded - This is called when the widget successfully loaded and reading to do the integration
ticket:agent_handoff: This is called when AI successfully created the ticket in help desk after human user has submitted the email in human hand off.
ticket:agent_handoff_initiated: This is called when AI detects that it needs to send the prompt for email ask. At this stage AI is awaiting email from user to submit in the form. Once user submits the form a ticket is created and ticket:agent_handoff is called.
ticket:message_submitted: This is called when user sends a message in the widget.
ticket:bot_response_finished: This is called when AI response is delivered in the widget
For e-commerce companies there are additional chat events sent in the sdk
product:added_to_cart : This is called when customer clicks add to cart inside the chat widget. It is useful to trigger code on your site to actually add the item to the cart, and show the user a cart popup or page.
product:page_opened : This is called when custome opens a product link rendered inside the chat widget
product:displayed: This is called when a product is rendered as a card inside the Gleen chat widget.
faqs:question_clicked : This is called when AI generated FAQ is clicked
window.gleenWidget.on('faqs:question_clicked', function(question_text) {
console.log('question text clicked. Question Text ' + question_text);
});
faqs:message_submitted : This is called when end user submits message in text box in product FAQ.
window.gleenWidget.on('faqs:message_submitted', function(user_message) {
console.log('User asked question in product FAQ. User message is' + user_message);
});
faqs:bot_response_finished: This is called when AI completes the streaming of response. It is applicable for both Product FAQ question clicked and message submitted in the text box.
window.gleenWidget.on('faqs:bot_response_finished', function(response_text) {
console.log('AI Finished the response. Response is ' + response_text);
});
Last updated