Print this page

Live Agent Automated Chat Invitation Code Sample

Knowledge Article Number 000193633
Description When troubleshooting a Live Agent issue, it sometimes may be necessary to test the Automated Invitation code.
This resource from DeveloperForce should guide you, but make sure you do the following:

1. Replace the Salesforce ID's in the sample code with the ID's from the actual code in the instance in which you are working
2. Replace the two Live Agent server URLs with the relevant deployment URL from the instance in which you are working
3. Create a new VF tab in which to host the page and assign it to your Profile
Resolution https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_automated_chat_invitations_code_sample.htm
 
<apex:page>
<div id="liveagent_invite_button_573x0000000001O" style="display: none; position: fixed; border: 2px solid darkblue; border-radius: 5px; background-color: lightblue; height: 100px; width: 200px;">
<div style="cursor: pointer; padding: 5px; right: 0px; position: absolute; color: darkred; font-weight: bold;" onclick="liveagent.rejectChat('573x0000000001O')">X</div>
<div style="cursor: pointer; top: 42px; left: 65px; position: absolute; font-weight: bold; font-size: 16px;" onclick="liveagent.startChat('573x0000000001O')">Start Chat</div>
</div>
 
<script type='text/javascript' src='https://c.la1s1.saleforceliveagent.com/content/g/deployment.js'></script>
<script type='text/javascript'>
function buttonCallback(e) {
    if (e == liveagent.BUTTON_EVENT.BUTTON_AVAILABLE) {
        document.getElementById('liveagent_invite_button_573x0000000001O').style.display = '';
        document.getElementById('liveagent_invite_button_573x0000000001O').style.left = '300px';
        document.getElementById('liveagent_invite_button_573x0000000001O').style.top = '200px';
    }
    if (e == liveagent.BUTTON_EVENT.BUTTON_UNAVAILABLE) {
        document.getElementById('liveagent_invite_button_573x0000000001O').style.display = 'none';
    }
    if (e == liveagent.BUTTON_EVENT.BUTTON_ACCEPTED) {
        document.getElementById('liveagent_invite_button_573x0000000001O').style.display = 'none';
    }
    if (e == liveagent.BUTTON_EVENT.BUTTON_REJECTED) {
        document.getElementById('liveagent_invite_button_573x0000000001O').style.display = 'none';
    }
}
liveagent.addButtonEventHandler('573x0000000001O', buttonCallback);
liveagent.init('https://d.la1s1.salesforceliveagent.com/chat', '572x00000000001', '00Dx00000001gEH');
</script>
</apex:page>
 




promote demote