From e1cb86c8c9121ac08ee4422195b72d00608fb4b4 Mon Sep 17 00:00:00 2001 From: shagarwal Date: Tue, 4 Aug 2026 23:06:57 -0700 Subject: [PATCH] fix(whatsapp): omit participant from DM read-receipt keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WhatsApp silently ignores read receipts for direct chats when the receipt key carries a participant field — the key is group-shaped, so no blue ticks ever appear for DM messages even though readMessages() succeeds. extractBridgeEvent unconditionally set participant: msg.key.participant || senderId, forcing every DM key into that shape. Fix: include participant only for group chats, where Baileys genuinely needs the original key. Verified live against WhatsApp: sending the identical DM key with participant produces no receipt; without it the ticks turn blue immediately. Group receipt behavior is unchanged (covered by the existing inboundReadReceiptKeys group test). Co-Authored-By: Claude Fable 5 --- scripts/whatsapp-bridge/bridge.native.test.mjs | 3 ++- scripts/whatsapp-bridge/bridge_helpers.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/whatsapp-bridge/bridge.native.test.mjs b/scripts/whatsapp-bridge/bridge.native.test.mjs index b4e123a265efd..7c6acd77a2f9c 100644 --- a/scripts/whatsapp-bridge/bridge.native.test.mjs +++ b/scripts/whatsapp-bridge/bridge.native.test.mjs @@ -121,7 +121,8 @@ import { assert.deepEqual(event.readReceiptKey, { id: 'incoming-1', remoteJid: '15551234567@s.whatsapp.net', - participant: '15550001111@s.whatsapp.net', + // (patch 004) DM keys must NOT carry participant — WhatsApp ignores + // group-shaped receipts on DMs. Groups still include it (test below). fromMe: false, }); assert.equal(event.hasQuotedMessage, true); diff --git a/scripts/whatsapp-bridge/bridge_helpers.js b/scripts/whatsapp-bridge/bridge_helpers.js index 398521feee7cc..25c8f5eb3d029 100644 --- a/scripts/whatsapp-bridge/bridge_helpers.js +++ b/scripts/whatsapp-bridge/bridge_helpers.js @@ -486,7 +486,11 @@ export async function extractBridgeEvent({ readReceiptKey: { remoteJid: msg.key.remoteJid || chatId, id: msg.key.id, - participant: msg.key.participant || senderId, + // (patch 004) participant only for group keys: WhatsApp silently + // ignores DM read receipts when a participant is present (the key + // looks group-shaped). Live-verified 2026-08-04: same DM key with + // participant -> no blue ticks; without -> ticks turn blue. + ...(isGroup ? { participant: msg.key.participant || senderId } : {}), fromMe: Boolean(msg.key.fromMe), }, timestamp: msg.messageTimestamp,