Conversation
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
- Add WHATSAPP_MARK_READ env var (default: false, opt-in)
- Batch readMessages instead of per-message API calls
- sendPresenceUpdate('available') before batch read for delivery
- parseEnvBool() helper for consistent env var parsing
- Skip fromMe, broadcast lists, and groups
- Validate msg.key before API calls
- Separate try/catch for sendPresenceUpdate and readMessages
- Logging for batch read count and errors
- Unit tests: parseEnvBool (11 cases), message filtering (8 cases), batch collection (4 cases)
- Code path checks: 11/11 passed
5cf5abe to
231d5d2
Compare
|
Thanks for tackling WhatsApp read receipts — the premise still exists on current main: the Baileys bridge’s Problems
Suggested changes
This is an automated hermes-sweeper review. |
Duplicate of #8690 — same WhatsApp read-receipt (blue tick) feature (#6539). This is a saturated competing-PR cluster; the earliest open implementation is #8690 (other open siblings: #9672, #13185). This PR adds a cleaner opt-in |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the opt-in, batched implementation. The Baileys bridge on current main still lacks a readMessages path, so the feature remains useful, but this version needs rework against the current handler.
Problems
scripts/whatsapp-bridge/bridge.jscollects a receipt key before the current self-chat and allowlist gates (bridge.js:625-647). The submittedmessagesToRead.push(...)can therefore acknowledge a foreign DM that the bridge deliberately rejects.- The PR adds
WHATSAPP_MARK_READas a user-facing behavior flag. The established path isconfig.yaml→plugins/platforms/whatsapp/adapter.py::_apply_yaml_config(adapter.py:1712-1743) → bridge subprocess environment (adapter.py:622-652); the project rubric requires behavioral settings to useconfig.yaml. - GitHub reports only
scripts/whatsapp-bridge/bridge.jschanged, so the tests claimed in the PR body are not present.
Suggested changes
- Collect receipt keys only after the same admission gates used for inbound delivery.
- Wire a default-false
whatsapp.mark_readconfig setting through the existing adapter bridge. - Add focused pure-helper tests for eligibility and one batched
readMessagescall.
This is an automated hermes-sweeper review.
| if (!chatId || !msg.key.id) continue; | ||
| // Queue for batch read-receipt (skip broadcast and groups) | ||
| if (!chatId.endsWith('@broadcast') && !chatId.endsWith('@g.us')) { | ||
| messagesToRead.push(msg.key); |
There was a problem hiding this comment.
This queues the receipt before the handler's self-chat and allowlist gates. A foreign DM rejected later by the current bridge policy would still receive a blue tick; collect this key only after the message has passed those admission checks.
Summary
Automatically mark incoming WhatsApp messages as read (blue ticks) when
WHATSAPP_MARK_READ=trueis set. Opt-in — disabled by default for privacy.Changes
scripts/whatsapp-bridge/bridge.jsWHATSAPP_MARK_READenv var (default:false— opt-in, not opt-out)parseEnvBool()helper for consistent env var parsingreadMessagesinstead of per-message API calls (single call per message batch)sendPresenceUpdate('available')before batch read for reliable delivery on bot accountsfromMe), broadcast lists, and groupsmsg.keyandremoteJidbefore any API callstry/catchforsendPresenceUpdateandreadMessages(presence failure doesn't block read)[blue-tick] Marked N message(s) as readscripts/whatsapp-bridge/__tests__/bridge-blue-tick.test.js(new)parseEnvBool(11 cases), message filtering (8 cases), batch collection (4 cases)How to Test
WHATSAPP_MARK_READ=truein environmentWHATSAPP_MARK_READ=falseor unset — verify no blue ticks are sentChecklist
Closes #6539