← view more API documentation

api.chat.sendMessageToVisitor

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

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

Examples

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

document.getElementById('help-me').onclick = function() {
    olark('api.chat.sendMessageToVisitor', {body: "Let me know if you have any questions."});
}

Discussion

Feel free to propose good uses for this method, or even drop us some suggestions for improvement! You can also join our mailing list to collaborate with other developers and get updates from us.