feat(message): opt-in deep chat history (deep=true) (#347)#371
Merged
Conversation
The live history endpoint was capped at 100 messages per request — OpenWA's own bound, not a WhatsApp limit, since whatsapp-web.js can load earlier messages on demand. Add a deep=true query that raises the ceiling to 2000 for reaching further back. Deep mode is metadata-only (ignores includeMedia, since base64 for up to 2000 messages would be an enormous payload). Default path unchanged (default 50, max 100). Baileys still returns 501 (no history sync).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #347.
Problem
GET /sessions/:id/messages/:chatId/historywas clamped to 100 messages max per request. As the reporter found, that ceiling is OpenWA's own — not a WhatsApp limit. The whatsapp-web.js engine drives WhatsApp Web's "load earlier messages" mechanism, so it can reach much further back; we were the bottleneck.Change
Add an opt-in
deep=truequery parameter:includeMediais ignored in deep mode — downloading base64 for up to 2000 messages would be an enormous, slow payload. Fetch media per-message separately.deep(documented).Tests (TDD, watched fail first)
Added 4 cases to
message.service.spec.ts: deep allows >100, deep clamps to 2000, deep forces media off, and a regression guard that non-deep still clamps to 100.npx jest→ 932/932 pass (86 suites)npm run build+eslintcleanDocs
Updated
docs/examples/chat-history-limits.md(which already tracked this as #347) to documentdeep=true, the 2000 ceiling, the metadata-only behavior, the rate-limit caveat, and the Baileys 501.