From d3f90a7abdde408d8f83590f3799f1d866a51314 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Sat, 21 Sep 2024 13:41:51 -0300 Subject: [PATCH] fix: chatwoot integration --- .../chatbot/chatwoot/services/chatwoot.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts index f5ed9aa1..36a64c18 100644 --- a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts +++ b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts @@ -223,6 +223,9 @@ export class ChatwootService { return true; } + console.log('organization', organization); + console.log('logo', logo); + this.logger.log('Creating chatwoot bot contact'); const contact = (await this.findContact(instance, '123456')) || @@ -322,6 +325,7 @@ export class ChatwootService { }; } + console.log('data', data); const contact = await client.contacts.create({ accountId: this.provider.accountId, data, @@ -369,6 +373,10 @@ export class ChatwootService { public async addLabelToContact(nameInbox: string, contactId: number) { try { + const uri = this.configService.get('CHATWOOT').IMPORT.DATABASE.CONNECTION.URI; + + if (!uri) return false; + const sqlTags = `SELECT id FROM tags WHERE name = '${nameInbox}' LIMIT 1`; const tagData = (await this.pgClient.query(sqlTags))?.rows[0];