Messenger API Tutorial
If you want to start a chat session programmatically by your own code, send an event to the client.
To quit the current session and disconnect, send quit event by calling
Direct Chat With Operator
You can start a chat session with a certain Operator. If the Operator is offline, the Webvisitor will be presented with the Offline Message form, there is no fallback to other Operators in that Group.
If you need to initialize DOM elements based on the Userlike client status, you can hook in the callback which is fired after the Userlike client is loaded.
You can query the current state of the Chat Widget.
|The default chat state before a chat session has been started.|
|Indicates that a live chat session is active.|
|Indicates that the chat window is minimized.|
|Indicates that the chat session has been disconnected.|
If you need to update DOM elements or parts of your business logic regarding the online or offline status of the chat button, you can hook in this callback. It is fired after the Userlike client checked if it should display the chat button based on your Widget configuration.
You might need to temporarily hide the chat button when it blocks the view of your application. The functions to do so work on a visual but not on a logical level. Which means that with these calls you can't make the chat button appear if it’s hidden due to your offline status. However, if you have e.g. a search function that would benefit from a hidden chat button, you can bind the focus and blur events of the field to hide or show the chat button when necessary.