whatsapp-http-api
whatsapp-http-api copied to clipboard
/api/messages - API not returning all the messages in a chat
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
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.