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.
This commit is contained in:
Vitordotpy 2025-11-28 21:28:45 -03:00
parent bee309cd28
commit 250ddd2e89
2 changed files with 2 additions and 2 deletions

View File

@ -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];
};

View File

@ -2527,7 +2527,7 @@ export class ChatwootService {
}
}
public getNumberFromRemoteJid(remoteJid: string) {
public normalizeJidIdentifier(remoteJid: string) {
if (!remoteJid) {
return '';
}