waha icon indicating copy to clipboard operation
waha copied to clipboard

[Feature Request] Repeat all messages from X to Y (or to the latest one) - history sync

Open devlikepro opened this issue 1 year ago β€’ 2 comments

We need to have an endpoint using which we can ask system to "reconcile" all "missed" messages during that period and send it via webhook. It'll contain both new and old messages, so it should be a new message.reconcile event and we'll send it in the batch in case of huge history

patron:PRO

devlikepro avatar Jul 26 '24 07:07 devlikepro

message.reconcile It’s a very good event Looking forward to using it soon

HuangDaHui avatar Jul 26 '24 09:07 HuangDaHui

Yessss we need thisss

Please do it faster πŸ™πŸ»πŸ™πŸ»

patron:PLUS

Khosravangroup avatar Aug 09 '24 12:08 Khosravangroup

Added in 2024.10.9

https://waha.devlike.pro/docs/how-to/chats/#get-messages


GET /api/{session}/chats/{chatId}/messages?limit=10

Available parameters:

  • downloadMedia=true - download media files (images, files) or not
  • [email protected] - chatId, phone number
    • chatId=all - get messages from all chats (works on NOWEBengine only)
  • limit=100 - limit the number of chats to return
  • offset=0 - skip the number of chats from the start
  • filter.timestamp.lte=1727745026 - filter messages by timestamp less than or equal to 1727745026
  • filter.timestamp.gte=1727745026 - filter messages by timestamp greater than or equal to 1727745026
  • filter.fromMe=false - filter messages from me (by default shows all messages)

Get 10 messages from 1727745026 timestamp, not from me

GET /api/{session}/chats/{chatId}/messages?limit=10&filter.timestamp.gte=1727745026&filter.fromMe=false

πŸ‘‰ If you have more messages - you can set offset flag (increase it always for limit amount, even if you get less messages)

GET /api/{session}/chats/{chatId}/messages?limit=10&offset=10&filter.timestamp.gte=1727745026&filter.fromMe=false

patron:PRO

devlikepro avatar Oct 27 '24 08:10 devlikepro

It would be amazing to have a way to fetch directly from WhatsApp's servers, not relying on WAHA's database. In our usecase, we keep emptying out the WAHA database to save on storage, but then might need it later in the future. Whatsmeow exposes it with BuildHistorySyncRequest and baileys with fetchMessageHistory

gergesh avatar Oct 20 '25 15:10 gergesh

@gergesh could you create a separate feature request, looks promising πŸ‘

patron:PRO

devlikepro avatar Oct 21 '25 04:10 devlikepro

@devlikepro I've created a separate issue #1544

gergesh avatar Oct 21 '25 10:10 gergesh