From 848ae569f235cb7ea497a1c2912a4d5bd27641b0 Mon Sep 17 00:00:00 2001 From: Sir Dobby Date: Thu, 29 Jan 2026 00:41:11 +0700 Subject: [PATCH] fix(whatsapp): require participant field for group reactions When reacting to WhatsApp group messages, the 'participant' field is required by Baileys but was previously optional, leading to silent failures where reactions appeared to succeed but were never sent. This change adds validation to fail fast with a clear error message when attempting to react to a group message without providing the participant JID. Fixes issue where reactions in WhatsApp groups returned {ok: true} but were never delivered to WhatsApp servers. Example error: WhatsApp group reactions require the 'participant' field (sender JID). Example: participant: '1234567890@s.whatsapp.net' --- extensions/whatsapp/src/channel.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/extensions/whatsapp/src/channel.ts b/extensions/whatsapp/src/channel.ts index 9d37fcf2a..a35d7c1ec 100644 --- a/extensions/whatsapp/src/channel.ts +++ b/extensions/whatsapp/src/channel.ts @@ -255,17 +255,28 @@ export const whatsappPlugin: ChannelPlugin = { const messageId = readStringParam(params, "messageId", { required: true, }); + const chatJid = + readStringParam(params, "chatJid") ?? readStringParam(params, "to", { required: true }); + const participant = readStringParam(params, "participant"); + + // Validate participant for group reactions + if (!participant && chatJid.endsWith("@g.us")) { + throw new Error( + "WhatsApp group reactions require the 'participant' field (sender JID). " + + "Example: participant: '1234567890@s.whatsapp.net'" + ); + } + const emoji = readStringParam(params, "emoji", { allowEmpty: true }); const remove = typeof params.remove === "boolean" ? params.remove : undefined; return await getWhatsAppRuntime().channel.whatsapp.handleWhatsAppAction( { action: "react", - chatJid: - readStringParam(params, "chatJid") ?? readStringParam(params, "to", { required: true }), + chatJid, messageId, emoji, remove, - participant: readStringParam(params, "participant"), + participant: participant ?? undefined, accountId: accountId ?? undefined, fromMe: typeof params.fromMe === "boolean" ? params.fromMe : undefined, },