From 2637aebb7fb4303df8011dc72b8891a0aa0afac4 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Mon, 31 Jul 2023 12:34:01 -0300 Subject: [PATCH] fix: Encoded spaces in chatwoot webhook --- src/whatsapp/controllers/chatwoot.controller.ts | 4 ++-- src/whatsapp/services/monitor.service.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/whatsapp/controllers/chatwoot.controller.ts b/src/whatsapp/controllers/chatwoot.controller.ts index 9dc493dc..46b93aee 100644 --- a/src/whatsapp/controllers/chatwoot.controller.ts +++ b/src/whatsapp/controllers/chatwoot.controller.ts @@ -52,7 +52,7 @@ export class ChatwootController { const response = { ...result, - webhook_url: `${urlServer}/chatwoot/webhook/${instance.instanceName}`, + webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`, }; return response; @@ -78,7 +78,7 @@ export class ChatwootController { const response = { ...result, - webhook_url: `${urlServer}/chatwoot/webhook/${instance.instanceName}`, + webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`, }; return response; diff --git a/src/whatsapp/services/monitor.service.ts b/src/whatsapp/services/monitor.service.ts index c0b9b610..f64c9a54 100644 --- a/src/whatsapp/services/monitor.service.ts +++ b/src/whatsapp/services/monitor.service.ts @@ -94,7 +94,7 @@ export class WAMonitoringService { if (findChatwoot && findChatwoot.enabled) { chatwoot = { ...findChatwoot, - webhook_url: `${urlServer}/chatwoot/webhook/${key}`, + webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(key)}`, }; }