waha icon indicating copy to clipboard operation
waha copied to clipboard

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

Open ehussain opened this issue 2 years ago • 3 comments

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.

ehussain avatar Jul 14 '23 08:07 ehussain

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

allburov avatar Jul 14 '23 08:07 allburov

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?

ehussain avatar Jul 14 '23 09:07 ehussain

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)

allburov avatar Jul 14 '23 09:07 allburov