Skip to content

Instantly share code, notes, and snippets.

@aawilson
Last active December 18, 2015 14:49
Show Gist options
  • Save aawilson/5800116 to your computer and use it in GitHub Desktop.
Save aawilson/5800116 to your computer and use it in GitHub Desktop.
Simple auto away message
var olarkTimeout = null;
olark('api.chat.onMessageToOperator', function(event) {
olarkTimeout = setTimeout(function(){
olark('api.chat.sendMessageToVisitor', {body: "It looks like the operator might be a little busy, hold on just a bit and we'll be right back with you!"});
}, 30 * 1000); // 30 seconds
});
olark('api.chat.onMessageToVisitor', function(event) {
if(olarkTimeout !== null){
clearTimeout(olarkTimeout);
olarkTimeout = null;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment