Live chat API - check if an agent is online | Community
Skip to main content

Live chat API - check if an agent is online

  • January 6, 2022
  • 0 replies
  • 0 views

Toby13

I want the Live chat widget to pop up after 15 seconds, but only if an agent is currently online. 

The following code works, but there doesn't seem to be a getter to find out if anyone is actually online. I don't want the widget to pop open if it says "Sorry no one is online at the moment!"

Thanks

Toby

<!-- Making the Zendesk widget pop up after a certain amount of time -->
<!-- https://developer.zendesk.com/documentation/classic-web-widget-sdks/chat-widget/customising-the-widget/making-the-widget-pop-up-after-a-certain-amount-of-time/ -->

<script type="text/javascript">
  window.setTimeout(function() {
    $zopim.livechat.button.show();
    $zopim.livechat.window.show();
    $zopim.livechat.bubble.show();
  }, 20000); //time’s in milliseconds - 30 seconds = 30000
</script>