whatsapp-api icon indicating copy to clipboard operation
whatsapp-api copied to clipboard

export all existing chat

Open masbudikusuma opened this issue 1 year ago • 3 comments

HI, Can I export all existing chats? I tried the "/client/getChats/{sessionId}" feature only today?

masbudikusuma avatar Mar 15 '24 12:03 masbudikusuma

The /client/getChats/{sessionId} endpoint is exactly what you need. The response will contain only the last message in the chat session, so you need fetch all messages using the /chat/fetchMessages/{sessionId} endpoint additionally.

avoylenko avatar Mar 21 '24 17:03 avoylenko

Does fetchMessages return all messages, regardless if there's 1 or 100,000 ?

SnakeO avatar Oct 15 '24 11:10 SnakeO

@SnakeO yes, it should return all messages that's why you have to pass the searchOptions option to apply the limit.

See https://docs.wwebjs.dev/Chat.html#fetchMessages

avoylenko avatar Oct 15 '24 11:10 avoylenko