From 86b2999fcf47735c5a30b747ce53aa688ff21298 Mon Sep 17 00:00:00 2001 From: Douglas Rauber at Nitro Date: Mon, 24 Jun 2024 10:37:54 -0300 Subject: [PATCH] Add -cwId- when findByName --- src/api/integrations/chatwoot/services/chatwoot.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/integrations/chatwoot/services/chatwoot.service.ts b/src/api/integrations/chatwoot/services/chatwoot.service.ts index 9a30dc12..ecda0a22 100644 --- a/src/api/integrations/chatwoot/services/chatwoot.service.ts +++ b/src/api/integrations/chatwoot/services/chatwoot.service.ts @@ -736,7 +736,12 @@ export class ChatwootService { } this.logger.verbose('find inbox by name'); - const findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox); + let findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox); + + if (!findByName) { + findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox.split('-cwId-')[0]); + } + if (!findByName) { this.logger.warn('inbox not found');