devlikeapro / waha

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

[Feature Request] Support limit/pagination on /chats and /contacts endpoints #371

Open heureka-dev opened 2 weeks ago

heureka-dev commented 2 weeks ago

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!

patron:ADVANCED

devlikepro commented 2 weeks ago

Related to

patron:PRO

devlikepro commented 2 weeks ago

Added limit and offset parameters to GET /api/{session}/chats endpoint.


Get all chats

Get all chats

GET /api/{session}/chats

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

patron:PRO