refactor(chatwoot): simplify findContact method and update contact creation logic

This commit is contained in:
Willian Coqueiro
2025-06-13 19:36:13 +00:00
parent bfb044b234
commit 1afa8df556
2 changed files with 63 additions and 105 deletions

View File

@@ -822,10 +822,10 @@ export class BaileysStartupService extends ChannelStartupService {
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) {
const instance = { instanceName: this.instance.name, instanceId: this.instance.id };
const findParticipant = await this.chatwootService.findContact(instance, {
identifier: contact.remoteJid,
phone_number: contact.remoteJid.split('@')[0],
});
const findParticipant = await this.chatwootService.findContact(
instance,
contact.remoteJid.split('@')[0],
);
if (!findParticipant) {
return;