feat(whatsapp): send read receipts - #9672
Closed
lobomfz wants to merge 1 commit into
Closed
Conversation
Contributor
|
Thanks for the focused implementation and the allowlist-aware placement.
This is an automated hermes-sweeper review. Closed as not-planned per standing maintainer policy ( |
13 tasks
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.
What does this PR do?
Marks inbound allowlisted WhatsApp messages as read via Baileys, so senders see blue ticks and — more importantly in practice — the bot's own WhatsApp account stops piling up unread-message notifications on the host device. Today, running Hermes on a second WhatsApp number means every message I send it generates a lingering system notification on that account's phone/web, even after the bot has processed and replied. Marking the message as read immediately after it clears the allowlist resolves that.
The approach mirrors the existing BlueBubbles read-receipt flag (
BLUEBUBBLES_SEND_READ_RECEIPTS) so the WhatsApp surface is consistent with the rest of the gateway: env var default-on, overridable via~/.hermes/config.yaml, and decoupled from the send path.Related Issue
Fixes #6055
Fixes #6539
(A different approach to the same problem is proposed in #8690; this PR adds an opt-out flag, uses fire-and-forget instead of
awaitinside the message loop, places the receipt call explicitly after thefromMeand allowlist filters to avoid leaking reads to unauthorized senders, and updates the user docs.)Type of Change
✨ New feature (non-breaking change that adds functionality)
Changes Made
scripts/whatsapp-bridge/bridge.js— readsWHATSAPP_SEND_READ_RECEIPTS(defaulttrue); callssock.readMessages([msg.key])fire-and-forget after thefromMe/allowlist filters; errors logged only whenWHATSAPP_DEBUG=truescripts/whatsapp-bridge/read_receipts.js— new pure helpershouldSendReadReceipt(msg, { enabled }), same extraction pattern asallowlist.jsscripts/whatsapp-bridge/read_receipts.test.mjs— fournode:testcases covering enabled, disabled,fromMe, and malformed inputsgateway/config.py— YAML keywhatsapp.send_read_receiptsbridged toWHATSAPP_SEND_READ_RECEIPTSenv var, matching the existingrequire_mention/mention_patterns/free_response_chatspatternwebsite/docs/reference/environment-variables.md,website/docs/user-guide/messaging/whatsapp.md,.env.example— documented env var and YAML optionHow to Test
WHATSAPP_SEND_READ_RECEIPTS=false(orwhatsapp.send_read_receipts: falsein~/.hermes/config.yaml) and repeat — no blue ticks, message stays unread on the bot side.node --test scripts/whatsapp-bridge/read_receipts.test.mjs scripts/whatsapp-bridge/allowlist.test.mjs— all 8 tests pass.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
N/A — change is a one-way WhatsApp protocol interaction; verification is visual (blue ticks on the sender side + cleared unread state on the bot side).