mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
feat: Native integration with chatwoot
This commit is contained in:
parent
be782ba512
commit
b4a9941452
@ -46,6 +46,10 @@ export class ChatwootService {
|
|||||||
instance.instanceName
|
instance.instanceName
|
||||||
].findChatwoot();
|
].findChatwoot();
|
||||||
|
|
||||||
|
if (!provider) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +106,10 @@ export class ChatwootService {
|
|||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!contact) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return contact;
|
return contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +134,10 @@ export class ChatwootService {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!contact) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return contact;
|
return contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +548,7 @@ export class ChatwootService {
|
|||||||
formatText = messageReceived;
|
formatText = messageReceived;
|
||||||
} else {
|
} else {
|
||||||
formatText = this.provider.sign_msg
|
formatText = this.provider.sign_msg
|
||||||
? `*${senderName}*: ${messageReceived}`
|
? `*${senderName}:*\n\n${messageReceived}`
|
||||||
: messageReceived;
|
: messageReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,10 +643,6 @@ export class ChatwootService {
|
|||||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||||
|
|
||||||
if (event === 'messages.upsert') {
|
if (event === 'messages.upsert') {
|
||||||
// if (body.key.fromMe && !IMPORT_MESSAGES_SENT) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (body.key.remoteJid === 'status@broadcast') {
|
if (body.key.remoteJid === 'status@broadcast') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -699,6 +707,11 @@ export class ChatwootService {
|
|||||||
if (event === 'status.instance') {
|
if (event === 'status.instance') {
|
||||||
const data = body;
|
const data = body;
|
||||||
const inbox = await this.getInbox(instance);
|
const inbox = await this.getInbox(instance);
|
||||||
|
|
||||||
|
if (!inbox) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const msgStatus = `⚡️ Status da instância ${inbox.name}: ${data.status}`;
|
const msgStatus = `⚡️ Status da instância ${inbox.name}: ${data.status}`;
|
||||||
await this.createBotMessage(instance, msgStatus, 'incoming');
|
await this.createBotMessage(instance, msgStatus, 'incoming');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user