waha icon indicating copy to clipboard operation
waha copied to clipboard

[NOWEB] - direct message without phone number (@lid problems)

Open mrbitencourt opened this issue 1 year ago • 16 comments

Describe the bug

We are receiving direct message without identify the phone number. The contact does not exists in the phone. We are not able to identify the phone number by lid.

Version

Get the WAHA version by calling GET /api/version

{ "version": "2025.6.4", "engine": "NOWEB", "tier": "PLUS", "browser": null }

Webhook payload

{ "id": "evt_01jyewpavw2ns6gc9j48ta562t", "session": "WAHA-PV-11807", "event": "message", "payload": { "id": "false_4639135154355@lid_297A4A9CC7BD7B111D49B72C8832D6D3", "timestamp": 1750699027, "from": "4639135154355@lid", "fromMe": false, "source": "app", "body": "Tudo indo. Sim", "hasMedia": false, "media": null, "ack": 2, "ackName": "DEVICE", "replyTo": null, "_data": { "key": { "remoteJid": "4639135154355@lid", "fromMe": false, "id": "297A4A9CC7BD7B111D49B72C8832D6D3" }, "messageTimestamp": 1750699027, "pushName": "rochafabiano31", "broadcast": false, "message": { "extendedTextMessage": { "text": "Tudo indo. Sim", "previewType": "NONE", "contextInfo": { "expiration": 7776000, "ephemeralSettingTimestamp": "1741704825", "disappearingMode": { "initiator": "INITIATED_BY_ME", "trigger": "ACCOUNT_SETTING", "initiatedByMe": true } }, "inviteLinkGroupTypeV2": "DEFAULT" }, "messageContextInfo": { "deviceListMetadata": { "senderTimestamp": "1748188745", "recipientKeyHash": "EWokRA4dJO96qQ==", "recipientTimestamp": "1748645964" }, "deviceListMetadataVersion": 2, "messageSecret": "f90rSW9ZMiW/l35PVBbwZjrz/yjDKEHEkoCbqJ+k12Q=" } }, "status": 3 } }, "timestamp": 1750699027324, "me": { "id": "[email protected]", "pushName": "Recepção" }, "engine": "NOWEB", "environment": { "version": "2025.6.4", "engine": "NOWEB", "tier": "PLUS", "browser": null } }

patron:PLUS

mrbitencourt avatar Jun 23 '25 17:06 mrbitencourt

Is not from a group ?

patron:PLUS

michaelvips avatar Jun 23 '25 19:06 michaelvips

No, it's not . It's a direct message

patron:PLUS

mrbitencourt avatar Jun 23 '25 19:06 mrbitencourt

Hi! @mrbitencourt can you see the phone number for that chat on the mobile app?

patron:PRO

devlikepro avatar Jun 24 '25 06:06 devlikepro

Yes, I can see the phone number on the mobile app.

patron:PLUS

mrbitencourt avatar Jun 25 '25 15:06 mrbitencourt

I think you can use api to get phone number from @lid

patron:PLUS

hsxonz avatar Jun 27 '25 16:06 hsxonz

Try this api "http://localhost:3000/api/default/lids/135360759779349%40lid"

patron:PLUS

hsxonz avatar Jun 27 '25 16:06 hsxonz

We tried but the result is this:

{ "lid": "135360759779349@lid", "pn": null }

patron:PLUS

mrbitencourt avatar Jun 27 '25 18:06 mrbitencourt

Why webhook does not have the phone number?

patron:PLUS

mrbitencourt avatar Jun 30 '25 20:06 mrbitencourt

Related https://github.com/devlikeapro/waha/issues/1097

patron:PRO

devlikepro avatar Jul 03 '25 09:07 devlikepro

Im having the same issue.

New contacts message me on WhatsApp through private conversations every day. In all of these cases, the initial messages are identified using the @c.us format. However, in some cases, after a while, the messages from that same contact stop coming with @c.us and instead start being identified as @lid.

I found this odd, because when the identifier switches to @lid, even the message structure in the API response changes. That alone would be fine — I adapted my logic to handle this by using the API endpoint /api/{session}/lids/{lid} to retrieve the corresponding c.us.

In some cases, this works — I can get the phone number from the lid and match it back to the contact.

But in other cases, like the one shown in the screenshot I'm sharing, the PN field comes back as null. That means I have no way to link this lid to a phone number, leaving me stuck.

Here are some examples of the firsts messages: response_1751505105744.json

And some examples of the same conversation but after it changes to @lid: response_1751505255484.json

patron:PLUS

Im having the same issue, any updates?

rogeiru avatar Jul 04 '25 12:07 rogeiru

I'm experiencing this issue as well, and because of it, I'm missing some messages. This is causing problems and affecting the credibility of my system with my clients. Are you currently working on a fix?

carlos-kryzalis avatar Jul 04 '25 17:07 carlos-kryzalis

Yes, working on the fix 🤞

patron:PRO

devlikepro avatar Jul 06 '25 05:07 devlikepro

Hi! Lid to phone number mapping work better in 2025.7.4, NOWEB https://waha.devlike.pro/docs/how-to/contacts/#api---lids

You'll still receive @lid as chat id, but on the first message it usually send a mapping for such lids (and also for some contacts) so you can lookup it later with

GET /api/{session}/lids/{lid}
{
  "lid": "123123123@lid",
  "pn": "[email protected]"
}

pn is chat id in phone number format

👉 pn can be null in case of old chats or if contact doesn't share his phone number.

lid => pn mapping shouldn't change (but who knows Meta), so you can cache it on your app side to avoid calling API to get the mapping

patron:PRO

devlikepro avatar Jul 06 '25 10:07 devlikepro

Hello, @devlikepro

Same problem here with this version

"environment": { "version": "2025.6.6", "engine": "GOWS", "tier": "PLUS", "browser": "/usr/bin/chromium" }

Was this fixed too ?

davidgarciait avatar Jul 11 '25 09:07 davidgarciait

@davidgarciait try to update https://github.com/devlikeapro/waha/issues/1073#issuecomment-3041301677

patron:PRO

devlikepro avatar Jul 11 '25 09:07 devlikepro