devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! Two engines: chromium-based WEBJS and pure-websocket NOWEB
https://waha.devlike.pro/
Apache License 2.0
977 stars 293 forks source link

/api/messages - get messages in a chat with date time range #140

Open ehussain opened 1 year ago

ehussain commented 1 year ago

Hello,

Currently /api/messages api has parameter named 'limit' that represents count of messages that you need. However we would like to receive messages only which falls within datetime range. So we only get the latest messages after specific timestamp.

Thank you.

allburov commented 1 year ago

The best way to handle it - listen to webhooks and save information in your database and query it

ehussain commented 1 year ago

How do we get the messages that was received on phone when session was not connected? How do we sync those messages with our database?

allburov commented 1 year ago

You can get like limit 1000 and search new messages there. If you can get more than 1000 new messages while the session is off - I think you should look at the official API, they give much more stability.

Btw, from what I saw before - if the session is stopped and started after certain time - it'll send all "missed" messages to a webhook (if you use the same session, not a new one by scanning QR)