Skip to content

Instantly share code, notes, and snippets.

@RockyMtnMarc
Last active September 26, 2019 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RockyMtnMarc/71997e745c0b3c77ed247e97b478b1fa to your computer and use it in GitHub Desktop.
Save RockyMtnMarc/71997e745c0b3c77ed247e97b478b1fa to your computer and use it in GitHub Desktop.
Visualforce code example for an Lightning Console Einstein Bots Utility
<apex:page >
<!--BEGIN Chat Button Code Snippet-->
<a id="liveagent_button_online_5733i000000gfJr" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('5733i000000gfJr')"><!-- Online Chat Content --></a><div id="liveagent_button_offline_5733i000000gfJr" style="display: none;"><!-- Offline Chat Content --></div><script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('5733i000000gfJr', document.getElementById('liveagent_button_online_5733i000000gfJr'));
liveagent.showWhenOffline('5733i000000gfJr', document.getElementById('liveagent_button_offline_5733i000000gfJr'));
});</script>
<!--END Chat Button Code Snippet-->
<!--BEGIN Chat Deployment Code Snippet-->
<script type='text/javascript' src='https://c.la4-c2-ph2.salesforceliveagent.com/content/g/js/46.0/deployment.js'></script>
<script type='text/javascript'>
<!--BEGIN Button Event Handler-->
liveagent.addButtonEventHandler('YOUR_BUTTON_ID_HERE',function (e){
if(e == liveagent.BUTTON_EVENT.BUTTON_AVAILABLE){
liveagent.startChatWithWindow('YOUR_BUTTON_ID_HERE', window.name);
}
});
<!--END Button Event Handler-->
liveagent.init('https://d.la4-c2-ph2.salesforceliveagent.com/chat', '5723i000000gInw', '00D3i000000ppG0');
</script>
<!--END Chat Depoyment Code Snippet-->
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment