Developing with Olark

We have a powerful Javascript API that gives you broad flexibility and control over the behavior of the Olark chat box. The possibilities range from attaching customer data to the buddy list, to adding notifications sounds, to enabling canned messages.

We even have some helpful developer tools built right in to the Olark chatbox. Just type the !develop command from the operator side of the chat, and the developer tools will pop up on the visitor side.

Give it a shot! All you need to do is ensure you have the latest Olark code on your page. Once you have that, you'll be able to use any of the Javascript methods defined below.

Looking for code examples?

Just click on any of the methods below. Each method comes with a full example of a scenario where you might want to use it!

For example, you can use the api.chat.updateVisitorNickname method to customize the visitor details that you see in the buddylist. If you're feeling more savvy, take a look api.chat.getDetails method to filter through your visitors and create some rules to make sure you get in touch with your most important customers.

With the Olark Javascript API, you can...

...keep track of relevant customer information

...target your most important customers

...send messages, update the buddy list, and control notifications

...react to messages, commands, and other changes in the chat

...show, hide, and manipulate the chatbox

...monitor whenever the chatbox is expanded, hidden, or otherwise changed

...tweak the chatbox behavior with configuration

  • olark.configure('box.corner_position', 'BL');
    puts the chatbox in the bottom-left corner. Valid values include TL, TR, BL, BR. (NOTE: may not work with all themes)
  • olark.configure('box.start_hidden', true);
    hides the chat box initially on this page, great for pages where you don't want to start chats, but still want to continue existing chats
  • olark.configure('system.disable_default_visitor_information', true);
    this will turn off all of the initial pre-chat notifications that give you visitor context, allowing you to show just your own custom pre-chat information instead
  • olark.configure('WelcomeAssist.welcome_messages', ["¡Bienvenidos a nuestro sitio!"]);
    allows greeter messages to be customized with JavaScript (be sure to check out our help article on translations as well!)
  • olark.configure('VisitorInsight.give_location_to_operator', false)
    Has the same effect as typing '!unfollow' at the beginning of every conversation.
  • More options added all the time, stay tuned!

...and lots more!

Discussion

Feel free to propose good uses for the Olark API, 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.