From 370025b8f95dfe3f5a907c256bbf41ae25ff95b0 Mon Sep 17 00:00:00 2001 From: joaosantanadev <82423306+joaosantanadev@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:59:48 -0300 Subject: [PATCH] Correction of webhook global --- src/api/integrations/event/webhook/webhook.controller.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/api/integrations/event/webhook/webhook.controller.ts b/src/api/integrations/event/webhook/webhook.controller.ts index 2fcf6c44..73d33afa 100644 --- a/src/api/integrations/event/webhook/webhook.controller.ts +++ b/src/api/integrations/event/webhook/webhook.controller.ts @@ -66,10 +66,7 @@ export class WebhookController extends EventController implements EventControlle local, }: EmitData): Promise { const instance = (await this.get(instanceName)) as wa.LocalWebHook; - - if (!instance || !instance?.enabled) { - return; - } + const webhookConfig = configService.get('WEBHOOK'); const webhookLocal = instance?.events; @@ -82,14 +79,14 @@ export class WebhookController extends EventController implements EventControlle event, instance: instanceName, data, - destination: instance?.url, + destination: instance?.url || `${webhookConfig.GLOBAL.URL}/${transformedWe}`, date_time: dateTime, sender, server_url: serverUrl, apikey: apiKey, }; - if (local) { + if (local && !instance || !instance?.enabled) { if (Array.isArray(webhookLocal) && webhookLocal.includes(we)) { let baseURL: string;