From 250ddd2e89082c7a77c612e923b5cb68b7644cde Mon Sep 17 00:00:00 2001 From: Vitordotpy Date: Fri, 28 Nov 2025 21:28:45 -0300 Subject: [PATCH] fix(chatwoot): improve jid normalization and type safety in chatwoot integration Refactor to preserve LID identifiers and update parameter type for better type safety as per code review feedback. --- .../integrations/channel/whatsapp/whatsapp.baileys.service.ts | 2 +- .../integrations/chatbot/chatwoot/services/chatwoot.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 32cd1ba3..e055b2bd 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -1609,7 +1609,7 @@ export class BaileysStartupService extends ChannelStartupService { // This enables LID to phoneNumber conversion without breaking existing webhook consumers // Helper to normalize participantId as phone number - const normalizePhoneNumber = (id: string | any): string => { + const normalizePhoneNumber = (id: string | null | undefined): string => { // Remove @lid, @s.whatsapp.net suffixes and extract just the number part return String(id || '').split('@')[0]; }; diff --git a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts index 0ceaa3eb..906fff18 100644 --- a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts +++ b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts @@ -2527,7 +2527,7 @@ export class ChatwootService { } } - public getNumberFromRemoteJid(remoteJid: string) { + public normalizeJidIdentifier(remoteJid: string) { if (!remoteJid) { return ''; }