devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
820 stars 249 forks source link

[BUG][NOWEB] - When using "Get chat presence" feature , sometimes get null value for last seen #255

Closed SeanTong11 closed 2 weeks ago

SeanTong11 commented 5 months ago

When using "Get chat presence" feature(GET /api/{session}/presence/) , sometimes get null value for lastseen,and sometimes it returns a valid number.Why this happened? Is there anyone who could explain it? Any response will be greatly appreciated!

Version

{
  "version": "2023.12.1",
  "engine": "NOWEB",
  "tier": "CORE",
  "browser": "/usr/bin/chromium"
}

To Reproduce Steps to reproduce the behavior:

  1. start a session,scan qr code to login
  2. call GET /api/default/presence/xxxx@c.us
  3. sometimes get null value for last seen, sometimes do not.

Expected behavior

get a valid number for last seen

Engine
I'm using NOWEB engine.

Requests - Responses

http://localhost:3001/api/default/presence/xxxxxx@c.us

{ "id": "xxxxxx@c.us", "presences": [ { "participant": "xxxxxx@c.us", "lastKnownPresence": "offline", "lastSeen": null } ] } Docker Logs

Collect and attach related docker logs if you have any https://waha.devlike.pro/docs/how-to/deploy/#viewing-the-logs

Screenshots

image

Additional context

Add any other context about the problem here.

allburov commented 5 months ago

Hi! Are all requirements satisfied? From https://faq.whatsapp.com/419827870318306

There are a few reasons why you might not be able to see someone's last seen or online:

  • They might have set their privacy settings to hide this information.
  • You might have set your privacy settings to not share your last seen. If you don't share your last seen, you can't see other contacts' last seen.
  • You might have been blocked.
  • You might not have chatted with them before.
  • They might not have you saved as a contact.
  • You might not have them saved as a contact.

Have you subscribed first? https://waha.devlike.pro/docs/how-to/presence/#subscribe-to-presence Last seen will be updated only when the client (the session) actually sees the participant online. So if you request that information right after you session started - it can be null, totally fine. But if the session sees that person online - it remembers the last time in lastSeen field. No way to get that information for person who the session never seen online (but before to subscribe https://waha.devlike.pro/docs/how-to/presence/#subscribe-to-presence)

SeanTong11 commented 5 months ago

Hi! Are all requirements satisfied? From https://faq.whatsapp.com/419827870318306

There are a few reasons why you might not be able to see someone's last seen or online:

  • They might have set their privacy settings to hide this information.
  • You might have set your privacy settings to not share your last seen. If you don't share your last seen, you can't see other contacts' last seen.
  • You might have been blocked.
  • You might not have chatted with them before.
  • They might not have you saved as a contact.
  • You might not have them saved as a contact.

Have you subscribed first? https://waha.devlike.pro/docs/how-to/presence/#subscribe-to-presence Last seen will be updated only when the client (the session) actually sees the participant online. So if you request that information right after you session started - it can be null, totally fine. But if the session sees that person online - it remembers the last time in lastSeen field. No way to get that information for person who the session never seen online (but before to subscribe https://waha.devlike.pro/docs/how-to/presence/#subscribe-to-presence)

Thanks a lot! I will do more test on this.

devlikepro commented 2 weeks ago

Let us know if the above doesn't help you!

patron:PRO