From df841aed272f57ad8e9d37833f9bc3f83db4476a Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Sun, 18 Feb 2024 09:06:59 -0300 Subject: [PATCH] fix: adjusts in fetch instances --- src/whatsapp/services/monitor.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/whatsapp/services/monitor.service.ts b/src/whatsapp/services/monitor.service.ts index c46a88be..a2899d7c 100644 --- a/src/whatsapp/services/monitor.service.ts +++ b/src/whatsapp/services/monitor.service.ts @@ -108,10 +108,14 @@ export class WAMonitoringService { } const findIntegration = await this.waInstances[key].findIntegration(); - const integration = { - ...findIntegration, - webhook_wa_business: `${urlServer}/webhook/whatsapp/${encodeURIComponent(key)}`, - }; + + let integration: any; + if (findIntegration) { + integration = { + ...findIntegration, + webhook_wa_business: `${urlServer}/webhook/whatsapp/${encodeURIComponent(key)}`, + }; + } if (value.connectionStatus.state === 'open') { this.logger.verbose('instance: ' + key + ' - connectionStatus: open');