Home > How do I open the chat window programmatically?

Categories: |


(Last Updated On: July 6, 2017)

Overview

There are a few ways to start a chat using our Javascript API’s after you have the SnapEngage code installed on your website. Your usage may depend on exactly what you’re hoping to do, but in most cases we recommend using the following.


You can make this a call from a JavaScript function, or hook it onto the “onclick” attribute on an HTML tag.

This function has a few parameters/settings that you should know about if you are going to be using it. The Javascript API documentation can be found here.

(Your other option is the simpler SnapEngage.startLink();)

If you’re not super Javascript savvy, but want to use the .openProactiveChat() function, here are a few example use cases for you:

Send chat invitation when a visitor lands on a page:

You will probably want to avoid bugging your visitor by constantly sending chat invitations. Not setting the forced parameter lets the parameter default to false. This means: if a visitor closes the chat window with the X-button, they won’t receive a new chat invitation for a while (default 30 minutes).

Force a chat invitation on a certain page

In this case, you’re setting the forced parameter to true so that SnapEngage will send a chat invitation whether or not the visitor has recently closed a chat window. However, if you do not have any agents available to chat, you will probably not want the offline form to show up as soon as a visitor lands on this page. Do not set the offlineFallback parameter to let it default to false.

You will probably want to call the function with the forced and offlineFallback options set to true. That way, if someone clicks the link when you have no agents available, they can still contact you through the Offline form.

*Note: If you have not updated your SnapEngage Javascript Code Snippet since January 1st, 2013, please do so by: going to your Admin Dashboard, using the “Get the code” tab, and pasting the new code snippet in place of the old one.

Did you find this article helpful?

Not HelpfulNeeds WorkSo-soHelpfulVery Helpful (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Published January 12, 2012