Chat widget API
Last updated
Was this helpful?
Last updated
Was this helpful?
With the Chat widget API it is possible to control the chat widget's behavior and call the JavaScript methods listed below. For example, you can , or
The chat widget API is active whenever an Ebbot chat widget is loaded on a page. It can be tested through the developer console.
Use hooks to make the widget call a function.
Callback function invoked when widget code is loaded but chat window is not rendered yet
Callback function invoked when widget code is loaded and chat window is rendered
Callback function invoked when conversation is reset
Callback function invoked after create() API method call.
Callback function invoked after destroy() API method call.
Callback function invoked when the chat window is opened
Callback function invoked when the chat window is closed
Callback function invoked after query result
Callback function invoked after a bot message is received
Callback function invoked after user types a message
Callback function invoked after query result
Use methods to call a function in the widget.
Create chat widget if does not exist
Destroy chat widget if exist
Displays chat conversation box and initialises the chat
Returns true if the chat is initialized
Reset current session
Open chat window
Close chat window
Check if chat window is opened
Check if chat window is closed
Send Message
Set User Attribute
Trigger Scenario
End Chat
Transcript chat
Turn on/off chat notifications
Check if notifications are on/off
Hide the chat
Show the chat
Is the chat window hidden
Clears all the messages from the chat window
Returns true if the user is/was active
Returns true if the conversation is started
Returns an object containing the width and height of the widget (including blob, if its not on mobile). As calculations depend on the open animation, it might take 500ms for the size to update.