Home > How do I open a chat from an email link?

Categories:


(Last Updated On: August 5, 2021)

About This Article

The purpose of this article is to provide a comprehensive overview of how to open a chat from an email link.

Overview

You can start a chat from an email link, however, there are certain limitations. SnapEngage needs an active browser window to work — JavaScript code can not be included in emails for security reasons. So you’ll need to create a special “landing page” for these email links.


Create your landing page

This can be any old page on your site, it’s up to you to design the content.

The only requirement is that you install the SnapEngage Code Snippet on that page.


Start the chat immediately

On this special landing page, you then add the following call to the SnapEngage code after the line: //Place your SnapEngage JS API Code below


SnapEngage.openProactiveChat(true, true);

This will open a Proactive Chat window without a delay when the page loads. (Assuming you have agents online. Otherwise this will open the Offline Form instead.)

If you would like to have a special first chat message on this page, you might consider creating a Proactive Rule for this landing page.

Alternatively

If you wish to make use of your Pre-Chat Form on this landing page, the above will not do that.

In this case, do not use the .openProactiveChat() function above. Use the following instead:


SnapEngage.startLink();

Optional addition

Since this page’s primary purpose is to receive visitors from these email links, it is likely that there won’t be a lot of useful content on the page.

So you can also add a callback that will close the special landing page once the chat window is closed.

You would then add the following code (Beneath your openProactiveChat or startLink call):


SnapEngage.setCallback('Close', function(type, status) {
// Code to call when the chat window is closed
document.location = '/';
// URL you send the visitor to, '/' is the home directory
});

You can modify the line document.location = '/'; if you’d like to send your visitor to a specific page.

For additional information on what this code is doing, feel free to check out our Javascript Events Documentation on our Developer API knowledgebase.

Did you find this article helpful?

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

Published January 18, 2012