Question
My customers can still chat with us after all agents have gone offline. Why is this happening?
Answer
In live chat, the connection is still open until the visitor ends the chat, or the chat session ends. For more information, see the article: When do chats time out?
An agent can end the chat in the user interface but the visitor could still have the chat dialogue open and begin a chat conversation. The new reply might go unanswered, which could cause confusion because there are no agents available to take the chat.
The exact behavior depends on the chat interface. When an agent leaves a live chat, the visitor can reopen the session by sending another message. In Agent Workspace, an agent can end the session; the visitor sees that the agent left the chat.
Adding custom script
It is possible to write a custom script that ends a chat as soon as an account goes offline.
<!--Callback to end chat when account goes offline -->
<script type="text/javascript"> zE('webWidget:on', 'chat:status', function (status) { if (status === 'offline') { zE('webWidget', 'chat:end') } else { console.log('This chat session is now', status); } }); </script>For more information, consult the Chat API documentation.