Effective Olark API Use: Sending messages via operator commands


As a developer at Olark, I really appreciate the creativity and ingenuity of the customers that integrate with our API. I find it rewarding to see people not only using the products we create, but also the APIs we provide to interact with our system. These interfaces provide a peek into the big machine that Olark is, to allow deeper integration of a customer’s specific needs to better communicate with their own users. Once in a while a special integration comes up that is so elegant that I can’t wait to share it with my co-workers and other Olark customers trying to solve a similar problem.

This time I’d like to highlight an integration for quickly sharing specific URLs with your visitors, without having to type them repeatedly during a chat session.

Using the Olark API to improve chat workflows

MaxCDN, a Content Delivery Network based in Los Angeles that has been an Olark customer for just over a year, implemented this integration as a way for operators to guide their online chat visitors to specific URLs, without having to frequently type them and avoiding potential spelling errors.

As Heather Weaver, Web Developer at MaxCDN tells me, "When we decided we needed a new live-chat system, I asked our support team what pain points they had. They said linking customers to pages on our site and relevant support articles was a challenge. The Olark API was perfect for automating that task."

They solved this issue with two of the Olark API commands:onCommandFromOperator and sendMessageToVisitor.

olark('api.chat.onCommandFromOperator', function(event) {
   // Checks for the !pricing command
   if (event.command.name == 'pricing') {
       // Automatically send the customer the pricing URL as a message
       olark('api.chat.sendMessageToVisitor', {
           body: "www.mywebsite.com/pricing"

In the code above, if an operator types the !pricing command when chatting with a visitor, an automatic message will be sent to the visitor that will show "www.mywebsite.com/pricing" as a clickable link. By handling different command names, a library of URL’s could be built, just like MaxCDN has done in order to streamline their operator experience so that they can focus on keeping their customers happy.

Since we recently revamped our Olark API page to make it easier to discover new features and find examples for API usages, I asked Heather how she, as a developer, discovers new functionality on the Olark API.

"Usually, it’s on an as needed basis whether it’s to solve a problem for an agent or to improve the functionality for our customers," she explained. "Olark support is great at pointing me to specific API calls and helping me to work out a solution that integrates well with our system and theirs."

Thank you for reading and so long, until next time where I plan to highlight another advanced API use from another one of our customers. In the meantime, why not visit our API documentation and see if you can find an opportunity to create a great integration with Olark.

Check out relevant topics on: Olark Essentials

Hector Urtubia

Read more posts by Hector Urtubia

Hector Urtubia is a product manager, software engineer, and resident Appstronomer at Olark. When he’s not shipping the next product, you can find him jamming with his band Schizopolitans in Reno, NV.