Provide 24/7 affordable customer service with AI-powered chat.
Connect to learn more

Automatic replies for delayed chats

Using the Olark api you can send your visitors a response if your agent does not reply to a message right away.

This script will automatically send a message to your visitor within 45 seconds of the agent not responding. Note that this script will only send a message to the visitor if the agent has never responded to them.

Important Notice: We’ll do our best to help with any questions you have. The API is intended to be self-serve for web developers, so we’re not able to write or debug your own code.

Script:


(function() {

  var secondsUntilAutoDelay = 45;
  var didSendMessageToVisitor = sessionStorage.getItem('didSendMessageToVisitor');

  olark('api.chat.onMessageToVisitor', function() {
    didSendMessageToVisitor = true;
    sessionStorage.setItem('didSendMessageToVisitor', true);
  });

  olark('api.rules.defineRule', {

    id: 'delayed_response',
    description: 'Will send a response to the visitor after an agent doesn\'t respond.',

    condition: function(pass) {
      olark('api.visitor.getDetails', function(details) {

        if (details.isConversing &&
            !didSendMessageToVisitor &&
            details.secondsSinceLastMessageToOperator >= secondsUntilAutoDelay) {
          pass();
        }

      });
    },

    // Message the visitor, but also notify the agent that they
    // hit this delay limit.
    action: function() {
      olark('api.chat.sendMessageToVisitor', {
        body: 'Sorry about the delay, I\'m a bit busy at the moment. Be with you in just a moment.'
      });
      olark('api.chat.sendNotificationToOperator', {
        body: 'Automated delay message has been sent to visitor.'
      });
    },

    // Only do this once per visit.
    perVisit: true

  });

})();



Please provide the domain name where your Olark live chat is installed.
Include the relevant transcript URL, if possible. You can send us the specific URL from your Transcripts page.
If you see specific error messages, banners, warnings, notices, etc., please let us know here.
Max file size 10MB.
Uploading...
fileuploaded.jpg
Upload failed. Max size for files is 10 MB.
Thank you! Your submission has been received and you'll hear from us shortly!
Oops! Something went wrong while submitting the form.