olark('api.chat.sendMessageToVisitor', options );

Arguments

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

Notes

Send a message to the visitor. It will appear as if the message came from an operator.

Trigger an automated message

Send a welcome message whenever a visitor clicks on a help me button:

<!-- HTML button -->
<a id="help-me" href="#">Live chat help</a>

<script>
document.getElementById('help-me').onclick = function() {

    olark('api.chat.sendMessageToVisitor', {
        body: "Let me know if you have any questions."
    });

    // Stops the link reloading the page
    return false;

}
</script>