Tutorial: 03. Unavailable

03. Unavailable

Change the agent status, available and unavailable.

Agent data

Lista de no disponibles

In order to get the unavailable list asigned to the user and be able to set the unavailable identifier, you need to execute the method: getUnavailables, wich returns a event at success onUnavailableTypes.

nuxibaIntegration.getUnavailables();

Event onUnavailableTypes

Here is an example.

/**
 * @description Unavailable list
 * @param {Array} UnavailableStatus [{id:uint, statusName:String, nAvaiable:String}]
 * @example: [{id:1,statusName:"Baño",nAvaiable:"n"},  {id:2,statusName:"Comida",nAvaiable:"1"}]
 * @event onUnavailableTypes
 */
function onUnavailableTypes(array) {
    console.log("onUnavailableTypes", array);
    document.getElementById("selectUnavailables").innerHTML = "";
    let notReadyList = document.getElementById("selectUnavailables");
    for (i = 0; i < array.length; i++) {
        if (array[i] !== undefined) {
            let option = document.createElement("option");
            option.text = array[i].TypeNotReadyId + "=" + array[i].Description;
            option.value = array[i].TypeNotReadyId;
            notReadyList.add(option);
        }
    }
}

Unavailable

There will be times when we need that the user stops receiving calls, in order to achieve that, the method setOnUnavailableStatus needs to be executed passing the unavailable's list identifier as a parameter.

nuxibaIntegration.setOnUnavailableStatus(1);

Available

To set the user as available, execute the method SetReady

nuxibaIntegration.SetReady();