[Feature Request] Support limit/pagination on /chats and /contacts endpoints
Is your feature request related to a problem? Please describe. Some of our accounts have thousands of active chats and contacts. Currently we're using WebJS, however the whole container crashes when we try to query the /chats and /contacts endpoints.
Describe the solution you'd like
The ability to either set a limit (maybe v1? of this?) in the query to these endpoints would be a good starting point, however in the future I'd love to see a pagination of some sorts.
As far as I can see WhatsApp Web uses some sort of "infinite load" pagination.
Additionally, maybe a search would be good too for both chats and contacts in case we are looking for one where we don't know the ID.
Describe alternatives you've considered
The alternative would be to not use these endpoints if your WhatsApp account have more chats/contacts then the system can handle.
Additional context We're running Whapi Plus on a 64GB Ram, 8 CPU machine, and the current ram utlization is arount 20 GB, while the CPU is around 15%, so well below the limits of the VPS.
Thank you!
Related to
- https://github.com/devlikeapro/waha/issues/331
- https://github.com/devlikeapro/waha/issues/278
Added limit and offset parameters to GET /api/{session}/chats endpoint.
- Read more about Get all chats
- Build:
2024.6.4 - Engine: WEBJS
- Engine: NOWEB
Get all chats
Get all chats
GET /api/{session}/chats
limit- limit the number of chats to returnoffset- skip the number of chats from the start
If you see timeout or the request takes too long - consider using limit parameter to get chats in smaller chunks
GET /api/{session}/chats?limit=100&offset=0
Added in 2024.10.9
- https://waha.devlike.pro/docs/how-to/chats/#pagination
- https://waha.devlike.pro/docs/how-to/contacts/#pagination
Pagination
If you see timeout or the request takes too long - consider using limit parameter to get contacts in smaller chunks
GET /api/{session}/contacts/all?limit=100&offset=0&sortBy=id&sortOrder=asc
limit=100- limit the number of chats to returnoffset=0- skip the number of chats from the startsortBy={field}- sort by fieldsortBy=id- sort by contact idsortBy=name- sort by contact name
sortOrder=desc|asc- sort orderdesc- descending order (A-Z)asc- ascending order (Z-A)