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

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

Open duladissa opened 4 months ago

duladissa commented 4 months ago

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

devlikepro commented 4 months ago

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:

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