I've configured automated invitation in live agent. But, the code is not working. The criteria is if the customer is on web page for more than 5 seconds. can some one help me in repairing the code.

< apex:page >
< div id="liveagent_invite_button_573i0000000WAtn" style=" 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('573i0000000WAtn');">X</div>
    < div style="cursor: pointer; top: 42px; left: 65px; position: absolute; font-weight: bold;font-size: 16px;" onclick="liveagent.startChat('573i0000000WAtn');">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_573i0000000WAtn').style.display ='';
        document.getElementById('liveagent_invite_button_573i0000000WAtn').style.left ='300px';
        document.getElementById('liveagent_invite_button_573i0000000WAtn').style.top ='200px';
    if (e == liveagent.BUTTON_EVENT.BUTTON_UNAVAILABLE) {
        document.getElementById('liveagent_invite_button_573i0000000WAtn').style.display ='none';
    if (e == liveagent.BUTTON_EVENT.BUTTON_ACCEPTED) {
        document.getElementById('liveagent_invite_button_573i0000000WAtn').style.display ='none';
    if (e == liveagent.BUTTON_EVENT.BUTTON_REJECTED) {
        document.getElementById('liveagent_invite_button_573i0000000WAtn').style.display ='none';
liveagent.addButtonEventHandler('573i0000000WAtn', buttonCallback);
liveagent.init('https://c.la1s1.saleforceliveagent.com/chat', '572i0000000W7Kp', '00Di0000000jzOh');
</ script>
</ apex:page>
  • There is some advice here that may help salesforce.stackexchange.com/questions/21547/…. – Keith C Mar 21 '14 at 9:21
  • No. That link speaks more about pre-chat form. I'm looking more at automated invitations. – Varun Krishna Mar 21 '14 at 10:08
  • OK my misunderstanding. What exactly is not working? What errors do you get in the browser's console? Does your buttonCallback get called (you can add a console.log to check) or is it that the "Start Chat" button doesn't work? – Keith C Mar 21 '14 at 11:02
  • 1
    Do you have any online agents for that skill? – PepeFloyd Mar 21 '14 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.