atualização para pegar a fila pelo nome a partir do argumento enviado pelo dialogflow
parent
cf67523bab
commit
3a7f1a2404
|
@ -523,7 +523,7 @@ async function sendDelayedMessages(
|
||||||
number: `${contact.number}@c.us`
|
number: `${contact.number}@c.us`
|
||||||
});
|
});
|
||||||
|
|
||||||
await transferTicket(+msgAction.actions[1], wbot, ticket);
|
await transferTicket(msgAction.actions[1], wbot, ticket);
|
||||||
} else if (msgAction.actions[0] == "send_file") {
|
} else if (msgAction.actions[0] == "send_file") {
|
||||||
const sourcePath = path.join(__dirname, `../../../public/bot`);
|
const sourcePath = path.join(__dirname, `../../../public/bot`);
|
||||||
|
|
||||||
|
@ -751,11 +751,7 @@ const verifyQueue = async (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const transferTicket = async (
|
const transferTicket = async (queueName: any, wbot: any, ticket: Ticket) => {
|
||||||
queueIndex: number,
|
|
||||||
wbot: any,
|
|
||||||
ticket: Ticket
|
|
||||||
) => {
|
|
||||||
const botInfo = await BotIsOnQueue("botqueue");
|
const botInfo = await BotIsOnQueue("botqueue");
|
||||||
|
|
||||||
const queuesWhatsGreetingMessage = await queuesOutBot(
|
const queuesWhatsGreetingMessage = await queuesOutBot(
|
||||||
|
@ -763,11 +759,19 @@ const transferTicket = async (
|
||||||
botInfo.botQueueId
|
botInfo.botQueueId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let queue: any;
|
||||||
|
|
||||||
const queues = queuesWhatsGreetingMessage.queues;
|
const queues = queuesWhatsGreetingMessage.queues;
|
||||||
|
|
||||||
// console.log('queues ---> ', queues)
|
// console.log("queues ---> ", console.log(JSON.stringify(queues, null, 6)));
|
||||||
|
|
||||||
await botTransferTicket(queues[queueIndex], ticket);
|
if (typeof queueName == "string") {
|
||||||
|
queue = queues.find((q: any) => q?.name == queueName.trim());
|
||||||
|
} else if (typeof queueName == "number") {
|
||||||
|
queue = queues[queueName];
|
||||||
|
}
|
||||||
|
|
||||||
|
await botTransferTicket(queue, ticket);
|
||||||
};
|
};
|
||||||
|
|
||||||
// const botMsgActions = (params: string) => {
|
// const botMsgActions = (params: string) => {
|
||||||
|
@ -820,7 +824,7 @@ const queuesOutBot = async (wbot: any, botId: string | number) => {
|
||||||
return { queues, greetingMessage };
|
return { queues, greetingMessage };
|
||||||
};
|
};
|
||||||
|
|
||||||
const botTransferTicket = async (queues: Queue, ticket: Ticket) => {
|
const botTransferTicket = async (queues: any, ticket: Ticket) => {
|
||||||
console.log(">>>>>>>>>>>>>>>>> queues.id: ", queues.id);
|
console.log(">>>>>>>>>>>>>>>>> queues.id: ", queues.id);
|
||||||
|
|
||||||
await ticket.update({ userId: null });
|
await ticket.update({ userId: null });
|
||||||
|
|
Loading…
Reference in New Issue