After customer registers his case and automated email is sent to him. In this email there should be an hyperlink - which initiates the live chat with available agent. From agent side- when he accepts the chat- he needs to get the existing case record window on his screen. This is the requirement. I'm trying to put the button and deployment code in the HTML email Template. But it is not working. Someone please help me to resolve this issue.
Below is the code that I'm trying to use in the email template.
<!-- Button Code -->
<a id="liveagent_button_online_582f000000000RK" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('582f000000000RK')" > CLick Here</a>
<div id="liveagent_button_offline_582f000000000RK" style="display: none;"> Sorry No Agent Available </div>
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('582f000000000RK', document.getElementById('liveagent_button_online_582f000000000RK'));
liveagent.showWhenOffline('582f000000000RK', document.getElementById('liveagent_button_offline_582f000000000RK'));})
</script>
<-- Deployment Code -->
<script type='text/javascript' src='https://c.la4-c8ch-iad.salesforceliveagent.com/content/g/js/40.0/deployment.js'></script>
<script type='text/javascript'>
<!-- liveagent.addCustomDetail('Case Number', '00001006'); -->
liveagent.addCustomDetail('Case Number', '{!Case.caseNumber}');
liveagent.findOrCreate('Case').map('CaseNumber','Case Number',true,true,true).saveToTranscript('CaseId').showOnCreate();
liveagent.init('https://d.la4-c8ch-iad.salesforceliveagent.com/chat', '582c0000000Cpya', '00Dk0000009w6Y7');
</script>