chrishubert / whatsapp-api

This project is a REST API wrapper for the whatsapp-web.js library, providing an easy-to-use interface to interact with the WhatsApp Web platform.
https://www.christophehubert.com
Other
829 stars 380 forks source link

export all existing chat #177

Open masbudikusuma opened 7 months ago

masbudikusuma commented 7 months ago

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

avoylenko commented 7 months ago

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.

SnakeO commented 1 week ago

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

avoylenko commented 1 week ago

@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