From 93fa55b7b701f6242571d37dbc606818439642b3 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Tue, 1 Sep 2026 14:56:33 +0700 Subject: [PATCH] fix(ChatWoot): name LID contacts by push name instead of raw @lid id - closes #1493 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julián Valdés --- src/apps/chatwoot/contacts/WhatsAppContactInfo.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/apps/chatwoot/contacts/WhatsAppContactInfo.ts b/src/apps/chatwoot/contacts/WhatsAppContactInfo.ts index 2a72bb2a..cb40cdeb 100644 --- a/src/apps/chatwoot/contacts/WhatsAppContactInfo.ts +++ b/src/apps/chatwoot/contacts/WhatsAppContactInfo.ts @@ -67,7 +67,9 @@ class JidContactInfo extends ChatContactInfo { } async PublicContactCreate(): Promise { - const contact: any = await this.session.getContact(this.chatId); + const contact: any = await this.session + .getContact(this.chatId) + .catch(() => null); const name = contact?.name || contact?.pushName || contact?.pushname || this.chatId; const phoneNumberE164 = E164Parser.fromJid(this.chatId); @@ -135,10 +137,15 @@ class LidContactInfo extends ChatContactInfo { if (jid) { result = await jid.PublicContactCreate(); } else { + const contact: any = await this.session + .getContact(this.chatId) + .catch(() => null); + const name = + contact?.name || contact?.pushName || contact?.pushname || this.chatId; result = { inbox_id: 0, identifier: this.chatId, - name: this.chatId, + name: name, }; } result.custom_attributes = await this.Attributes();