olark('api.chat.sendNotificationToVisitor', {
	body: string
});

Arguments

  • options.body
    the contents of the notification to send the visitor

Notes

Send a notification message to the visitor. The message will look like a notification, and will not show up as coming from a particular operator.

Notify a visitor if no immediate response

Assure a visitor that the operator will be back later if there is no response from an operator in 60 seconds:

<script>
// Set a timer variable
var lastMessageTimeout;

// Wait for a message to the visitor
olark('api.chat.onMessageToVisitor', function(){

    // If a message is sent, reset the timer
    clearTimeout(lastMessageTimeout);

    // Start the timer
    lastMessageTimeout = setTimeout(function(){

        // Send a custom notification to the visitor
        olark('api.chat.sendNotificationToVisitor',
        {
            body: "the operator just stepped out for a moment"
        })

    // Set timer to one minute (60,000 milliseconds)
    }, 60000);

});
</script>