whatsapp-http-api icon indicating copy to clipboard operation
whatsapp-http-api copied to clipboard

/api/messages - API not returning all the messages in a chat

Open duladissa opened this issue 11 months ago • 1 comments

Hello,

In the core version, we tried to fetch the /api/messages endpoint for a specific chatId but we are only getting less than 30 messages even though we added limit=100. Is this a limitation on whatsapp pagination support or we will be able to download the entire messages set for a particular chatId with WAHA plus version?

Thanks

duladissa avatar Mar 01 '24 23:03 duladissa

Hi! No, if it doesn't work in CORE it will not work in PLUS as well right now :( I haven't looked at that in the code, so just providing ideas about how you should treat it below.

The idea of that endpoint is just fetch "missed" messages after the session got restarted - it shouldn't be too long usually, so 30 messages looks like a good history. The main approach you should use to receive new messages - by listening webhooks:

  • https://waha.devlike.pro/docs/how-to/receive-messages/
  • https://waha.devlike.pro/docs/how-to/webhooks/

Don't treat GET /api/messages as database, just as a "get recent messages if possible". We didn't pay a lot of attention when implementing that method. We WILL tho include it as part of MongoDB storage store, but it's not available right now.

patron:PRO

devlikepro avatar Mar 02 '24 09:03 devlikepro