From 3459d61effb7a65046e7eb1c90ce94fb240968fc Mon Sep 17 00:00:00 2001 From: Willian Coqueiro Date: Thu, 22 May 2025 20:03:32 +0000 Subject: [PATCH] fix: Corrige o PR1481 --- .../chatbot/chatwoot/utils/chatwoot-import-helper.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/integrations/chatbot/chatwoot/utils/chatwoot-import-helper.ts b/src/api/integrations/chatbot/chatwoot/utils/chatwoot-import-helper.ts index 147ff936..f58b28e4 100644 --- a/src/api/integrations/chatbot/chatwoot/utils/chatwoot-import-helper.ts +++ b/src/api/integrations/chatbot/chatwoot/utils/chatwoot-import-helper.ts @@ -180,11 +180,10 @@ class ChatwootImport { const formattedSourceIds = sourceIds.map((sourceId) => `WAID:${sourceId.replace('WAID:', '')}`); // Make sure the sourceId is always formatted as WAID:1234567890 let query: string; if (conversationId) { - query = 'SELECT source_id FROM messages WHERE source_id = ANY($1)'; - } + query = 'SELECT source_id FROM messages WHERE source_id = ANY($1) AND conversation_id = $2'; if (!conversationId) { - query = 'SELECT source_id FROM messages WHERE source_id = ANY($1) AND conversation_id = $2'; + query = 'SELECT source_id FROM messages WHERE source_id = ANY($1)'; } const pgClient = postgresClient.getChatwootConnection();