Created
August 2, 2018 12:10
-
-
Save kylejmhudson/216dab3c2f158dba8b5727568c95f07b to your computer and use it in GitHub Desktop.
Zendesk Chat Widget: Open minimized chat window on new message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Show the chat window if the number of unread messages > 0 and the chat window is not currently displayed. | |
see references: | |
setOnUnreadMsgs - https://api.zopim.com/files/meshim/widget/controllers/LiveChatAPI-js.html#setOnUnreadMsgs | |
getDisplay - https://api.zopim.com/files/meshim/widget/controllers/liveChatAPI/Window-js.html#$zopim.livechat.window.getDisplay | |
show - https://api.zopim.com/files/meshim/widget/controllers/liveChatAPI/Window-js.html#$zopim.livechat.window.show | |
*/ | |
$zopim(function() { | |
$zopim.livechat.setOnUnreadMsgs(function(numUnread){ | |
if(numUnread > 0 && !$zopim.livechat.window.getDisplay()) { | |
$zopim.livechat.window.show(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment