rightnow-crm and unavailable hours

83 Views Asked by At

we have recently implemented rightnow proactive chat on our website, we have the chat widget set up by our central IT department to work off hours of availability for chat. I've got the widget working to an OK standard using this example http://cxdeveloper.com/article/proactive-chat-intercepting-chat-events

However, coming from Zendesk I was hoping to replicate the 'out of hours' or 'offline' modes of the Zendesk widget where it changes its behaviour when chat is offline.

After looking around I notice the widget can take a value for 'label_unavailable_hours:' however I cannot work out if this is available to the both the ConditionalChatLink and ProactiveChat modules. Does anyone have any experience with creating such functionality? I've also had a look at trying to pull data using chatAvailability but I am not doing that right either.

If anyone has an insight on how to get some kind of out of hours smarts working or if I am wasting my time try Id love to hear. My code is as below

$(document).ready(function() {

RightNow.Client.Controller.addComponent({
        instance_id: "spac_0",
        avatar_image: "",
        label_question: "A team member is available to help, would you like to start a chat?",
        label_avatar_image: "",
        label_dialog_header: "",
        logo_image: "",
        seconds: 2,
        enable_polling: "yes",
        div_id: "proactiveChatDiv",
        module: "ProactiveChat",
        //module: "ConditionalChatLink",
        min_agents_avail: 0, //remove this when live (when set to 0, no agents have to be free)
        min_sessions_avail: 1,
        label_unavailable_busy_template: "'All team members are busy. please email is us' + <a href='urlForEmail'>' + 'this place' + '</a>'", //out of hours
        label_unavailable_hours: "'Outside of hours' + <a href='urlForEmail'>' + 'this place' + '</a>'",
        type: 2
    },
    "https://ourWidgetCode"
);



//Widget loaded callback - this doesn't seem to work correctly hence the code below
RightNow.Client.Event.evt_widgetLoaded.subscribe(function(event_name, data) {
    if (data[0].id == "spac_0") {
        //Initialization
   
        console.log('widget loaded');
    }

    /* this wont work
    spac_0.prototype.chatAvailability = spac_0.chatAvailability;
    spac_0.chatAvailability = function()
    {
        console.log(spac_0.chatAvailability);
        {}
    };*/


    //Reset prototype
    spac_0.prototype = {};
    //Handle Chat Offered
    spac_0.prototype.chatOffered = spac_0.chatOffered;
    spac_0.chatOffered = function() {
        console.log("Chat Offered Handled");
        spac_0.prototype.chatOffered.call(this);
        //animate the widget to popup from bottom
        setTimeout(function() {
            $('div.yui-panel-container').addClass('animate');
        }, 2000)
        //delete the annoying session cookie that only allows the chat to appear once per session by default
        RightNow.Client.Util.setCookie("noChat", '', -10, '/', '', '');
    };

    //if the 'Do not ask again' is selected
    spac_0.prototype.chatRefused = spac_0.chatRefused;
    spac_0.chatRefused = function () {
        console.log("Do not ask again Selected");
        spac_0.prototype.chatRefused.call(this);
        //Reset the Cookie to be valid only for the session
        RightNow.Client.Util.setCookie("noChat",'RNTLIVE',0,'/',true,'');
    };
});

});

0

There are 0 best solutions below