Skip to content

Commit 682eaa9

Browse files
Merge pull request #1088 from joaosantanadev/develop
[FIX]Correction of webhook global
2 parents 62ea22a + 370025b commit 682eaa9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/api/integrations/event/webhook/webhook.controller.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ export class WebhookController extends EventController implements EventControlle
6666
local,
6767
}: EmitData): Promise<void> {
6868
const instance = (await this.get(instanceName)) as wa.LocalWebHook;
69-
70-
if (!instance || !instance?.enabled) {
71-
return;
72-
}
69+
7370

7471
const webhookConfig = configService.get<Webhook>('WEBHOOK');
7572
const webhookLocal = instance?.events;
@@ -82,14 +79,14 @@ export class WebhookController extends EventController implements EventControlle
8279
event,
8380
instance: instanceName,
8481
data,
85-
destination: instance?.url,
82+
destination: instance?.url || `${webhookConfig.GLOBAL.URL}/${transformedWe}`,
8683
date_time: dateTime,
8784
sender,
8885
server_url: serverUrl,
8986
apikey: apiKey,
9087
};
9188

92-
if (local) {
89+
if (local && !instance || !instance?.enabled) {
9390
if (Array.isArray(webhookLocal) && webhookLocal.includes(we)) {
9491
let baseURL: string;
9592

0 commit comments

Comments
 (0)