All the methods uses the chat id and ACD id that can b eobtained with the event onClientChatConnected, in the next example the variable listChatClient is added to save the ACD id and the client's name.
Evento onClientChatConnected
var listChatClient={};
/**
* @description Obtiene la informacion de un nuevo chat con el cliente <br/>
* chatId: Indentificador de la conversacion <br/>
* acdId: Indentificador del ACD <br/>
* clientName: Nombre del cliente
* @event onClientChatConnected
* @param {json} data {chatId:int, acdId:int, clientName:String}
* @example {chatId:1, acdId:2, clientName:"Jesus Gallardo"}
* @tutorial ChatClient
*/
function onClientChatConnected(data) {
console.log('onClientChatConnected', data);
console.info("Nuxiba_onClientChatConnected");
listChatClient[data.chatId] = { clientName: data.clientName, acdId: data.acdId };
var msg = "chatId: " + data.chatId + ", clientName: " + data.clientName + ", acdId:" + data.acdId;
chatIdTxt.val(data.chatId);
acdIdChatTxt.val(data.acdId);
}
Evento onClientChatMessageReceived
It receives a message from the client which is shown on the interface with the acd id and if the message was sent by a client or by and administrator.
/**
* @description Obtiene mensaje de un chat
* chatId: Identificador de la conversación <br/>
* admId: Identificador del Administrador si es cero es cliente <br/>
* message: Mensaje
* @event onClientChatMessageReceived
* @param {json} data {chatId:int, admId:int, clientName:String}
* @example {chatId:1, acdId:0, admId:0, message:"Necesito Ayuda"} //cliente
* @example {chatId:1, admId:2, message:"Pregunta de que tipo"} //Idtenficador del Admin
* @tutorial ChatClient
*/
function onClientChatMessageReceived(data) {
console.log('onClientChatMessageReceived', data);
var chatId = data.chatId
var type = data.admId === "0" ? listChatClient[data.chatId].clientName : "Supervisor " + data.admId;
var message = data.message;
var msg = reciveChatClient.val();
msg += "[" + type + "] chatId: " + chatId + ", msg:" + message + "\n"
reciveChatClient.val(msg);
chatIdTxt.val(chatId);
acdIdChatTxt.val(listChatClient[data.chatId].acdId);
}
Evento onClientChatFinished
Event fired when the chat is ended by the client.
/**
* @description Cuando termina la conversación el cliente
* @event onClientChatFinished
* @todo Revisar
* @param {json} data {chatId:int}
* @tutorial ChatClient
*/
function onClientChatFinished(data) {
console.log('onClientChatFinished', data);
}
Evento onClientChatWrapUpStarted
Starts the chat wrap up time
/**
* @description Cuando inicia el chat
* chatId: Identificador de la conversación <br/>
* expiration: Tiempo máximo para el chat termine en segundos
* @event onClientChatWrapUpStarted
* @param {json} data {chatId:int, expiration:int}
* @example {chatId:1, expiration:65}
* @tutorial ChatClient
*/
function onClientChatWrapUpStarted(data) {
console.log('onClientChatWrapUpStarted WrapUpTime ' + data.expiration, data);
}
Evento onClientChatWrapUpFinished
Ends the chat wrap up time
/**
* @description Cuando termina el tiempo de notas de un chat
* @event onClientChatWrapUpFinished
* @param {json} data data {chatId:int}
* @tutorial ChatClient
*/
function onClientChatWrapUpFinished(data) {
console.log('onClientChatWrapUpFinished', data);
}
Evento onClientChatTakeOver
When the administrator take control over the conversation with the client or the admin reads the conversation.
/**
* @description Cuando el administrador toma control de la conversación con el cliente o el admin escucha la conversación
* @event onClientChatTakeOver
* @param {json} data {chatId:int, message:string}
* @example {chatId:1, message:"0"} //message es 0 Instrucion
* @example {chatId:1, message:"1"} //message es 1 Solo puede platicar el cliente y el adminsitrador
* @tutorial ChatClient
*/
function onClientChatTakeOver(data) {
console.log('onClientChatTakeOver', data);
}
Enviar un mensaje
Send a message to the client
sendClientChatMessage(1,"Hola buenod dias en que puedo ayudarlo");
Terminar la conversacion
Closes the conversation from the agent.
finishClientChatConversation(1);
Calificar el chat
To disposition a chat it is needed that the dispositions are linked to the ACD by executing the methodgetACDDispositions.
disposeClientChat(1, 1); // Without subdisposition
disposeClientChat(2, 2, 45); // With subdisposition
Lista de plantillas
The templates list pre defined in the admin with the ACD id
getChatAnswerTemplates(1);
Evento onChatAnswerTemplates
Returns the templates list defined for the ACD when the method getChatAnswerTemplates is called.
/**
* @description Regresa la lista de plantillas para contestar de manera rápida cuando ejecuta el metodo getChatAnswerTemplates
* @event onChatAnswerTemplates
*
* @param {Array} data
* @example ["Hola","Saludo"]
* @tutorial ChatClient
*/
function onChatAnswerTemplates(data) {
console.log('onChatAnswerTemplates', data);
createTrigger.trigger("onChatAnswerTemplates", data);
}