Redirecting a Waiting Chat Session to the Email Form

Last Updated -

Overview

If you are using the Desk.com chat feature, you may occasionally have situations where your agents are unavailable to chat but your customers have already attempted to start a chat session. Using the method outlined in this article, you can redirect these waiting chat customers that have not been picked up by an agent to the email widget form after waiting two minutes.

Note: Before you start editing or adding a new Chat Widget theme, you first need to have scripting enabled (whitelisted) for your Desk site. To do this, email support@desk.com and request scripting enablement for your site.


Steps

  1. Go to Admin > Channels Chat Widgets
  2. In the upper right corner, select 'Chat Connected Screen' from the Type dropdown list

 
  1. Click the gear icon of the template you have set as the default. If you only have the Default theme, you will need to create a new one by clicking + Add Theme.
  2. Add this block of Javascript to the bottom of the Body section of the template:
 <script>

var timeout = 120000;
var redirectTo = "/customer/widget/emails/new";

setTimeout('checkForButton()', timeout)

function checkForButton()
{

if( "none" == $("#chat_send_area").css('display'))
{
window.location = redirectTo;
window.resizeTo(550,650);
}
}

</script>
 
  1. Change the "timeout" and "redirectTo" variables to your timeout value (in milliseconds) and the URL to redirect to, respectively. This default code will redirect customers to the email widget form if they have been waiting to be connected for an agent for two minutes.
  2. Click Update to save the template. 
  3. If you receive an error in your browser when clicking Update, please contact support so that we can authorize your site to use this code. If you've already had your site whitelisted for code, you won't receive an error and do not need to contact support.