openclaw - ✅(Solved) Fix WhatsApp outbound: missing quote-reply and @mention support [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#50944Fetched 2026-04-08 01:06:22
View on GitHub
Comments
1
Participants
1
Timeline
11
Reactions
0
Author
Participants
Timeline (top)
referenced ×8cross-referenced ×2commented ×1

WhatsApp outbound messages do not support quote-replies or @mentions. Both features work correctly on inbound (OpenClaw parses quoted messages and mentionedJid from incoming messages), but the outbound sendMessage implementation does not wire them up.

Root Cause

WhatsApp outbound messages do not support quote-replies or @mentions. Both features work correctly on inbound (OpenClaw parses quoted messages and mentionedJid from incoming messages), but the outbound sendMessage implementation does not wire them up.

Fix Action

Fixed

PR fix notes

PR #51059: fix(whatsapp): support quote-reply and @mention in outbound messages

Description (problem / solution / changelog)

Summary

Fixes issue #50944 where WhatsApp outbound messages did not support quote-reply or @mention.

Root Cause

  • replyToId parameter from ChannelOutboundContext and [[reply_to_current]] auto-reply tags was parsed but never forwarded to Baileys' sendMessage()
  • @+1234567890 mentions were never passed to contextInfo.mentionedJid

Changes

FileChange
src/channels/plugins/whatsapp-shared.tsThread replyToId through createWhatsAppOutboundBase
extensions/whatsapp/src/active-listener.tsAdd replyToId and mentionedJids to options
extensions/whatsapp/src/send.tsAccept and forward replyToId/mentionedJids
extensions/whatsapp/src/inbound/send-api.tsAttach contextInfo:{mentionedJid[]} and quoted:{key} to Baileys payload
extensions/whatsapp/src/inbound/types.tsUpdate reply/sendMedia types
extensions/whatsapp/src/inbound/monitor.tsImplement replyToId/mentionedJids in msg.reply()
extensions/whatsapp/src/auto-reply/deliver-reply.tsPass replyResult.replyToId and mentionedJids through
extensions/whatsapp/src/inbound/send-api.test.tsAdd 3 new tests
extensions/whatsapp/src/auto-reply/deliver-reply.test.tsUpdate for new replyOpts parameter

Test Plan

  • All 274 WhatsApp tests pass
  • 3 new tests for replyToId, mentionedJids, and combined media

Fixes #50944

🤖 Generated with Claude Code

Changed files

  • extensions/whatsapp/src/active-listener.ts (modified, +4/-0)
  • extensions/whatsapp/src/auto-reply/deliver-reply.test.ts (modified, +20/-3)
  • extensions/whatsapp/src/auto-reply/deliver-reply.ts (modified, +40/-25)
  • extensions/whatsapp/src/inbound/monitor.ts (modified, +43/-5)
  • extensions/whatsapp/src/inbound/send-api.test.ts (modified, +62/-1)
  • extensions/whatsapp/src/inbound/send-api.ts (modified, +34/-5)
  • extensions/whatsapp/src/inbound/types.ts (modified, +5/-2)
  • extensions/whatsapp/src/monitor-inbox.captures-media-path-image-messages.test.ts (modified, +10/-6)
  • extensions/whatsapp/src/monitor-inbox.streams-inbound-messages.test.ts (modified, +14/-6)
  • extensions/whatsapp/src/send.ts (modified, +9/-1)
  • src/channels/plugins/whatsapp-shared.ts (modified, +4/-1)

Code Example

const payload = {
  text,
  ...(replyToId ? { quoted: { key: { remoteJid: jid, id: replyToId } } } : {})
};

---

const payload = {
  text,
  ...(mentionedJids.length > 0 ? {
    contextInfo: { mentionedJid: mentionedJids }
  } : {})
};
RAW_BUFFERClick to expand / collapse

Summary

WhatsApp outbound messages do not support quote-replies or @mentions. Both features work correctly on inbound (OpenClaw parses quoted messages and mentionedJid from incoming messages), but the outbound sendMessage implementation does not wire them up.

Current Behavior

Quote-replies

The agent can use [[reply_to_current]] tags, and the reply pipeline parses replyToId / replyToCurrent correctly. However, createWebSendApi().sendMessage() in channel-web-*.js builds a payload with just { text } (or media fields) and never passes a quoted key to sock.sendMessage().

Result: The [[reply_to_current]] tag is stripped from the message text, but the outbound message is sent as a standalone message with no quote context.

@mentions

The agent can include @+1234567890 in message text, but sendMessage() never sets contextInfo.mentionedJid on the outbound payload.

Result: The phone number appears as literal text instead of rendering as a tappable WhatsApp mention that resolves to the contact name.

Expected Behavior

Quote-replies

When replyToId is available in the outbound context, sendMessage() should pass it as the quoted key in the Baileys message payload:

const payload = {
  text,
  ...(replyToId ? { quoted: { key: { remoteJid: jid, id: replyToId } } } : {})
};

@mentions

When the message text contains @+<number> patterns, sendMessage() should:

  1. Extract the mentioned numbers
  2. Convert them to JIDs (e.g., [email protected])
  3. Include them in contextInfo.mentionedJid
const payload = {
  text,
  ...(mentionedJids.length > 0 ? {
    contextInfo: { mentionedJid: mentionedJids }
  } : {})
};

Affected Code

  • createWebSendApi() in the WhatsApp channel web module (channel-web-*.js)
  • sendMessageWhatsApp() in the outbound module (outbound-*.js)

Impact

Without these features, AI agents in WhatsApp group chats cannot:

  • Thread replies to specific messages (making conversations hard to follow)
  • Properly mention group participants (mentions show as raw phone numbers)

This significantly reduces the usefulness of agents in group chat contexts.

Environment

  • OpenClaw 2026.3.13 (61d171a)
  • WhatsApp Web (Baileys)

extent analysis

Fix Plan

To fix the issue with WhatsApp outbound messages not supporting quote-replies or @mentions, we need to modify the createWebSendApi() function in channel-web-*.js and the sendMessageWhatsApp() function in outbound-*.js. Here are the steps:

  • Modify createWebSendApi() to pass the quoted key in the Baileys message payload when replyToId is available:
const payload = {
  text,
  ...(replyToId ? { quoted: { key: { remoteJid: jid, id: replyToId } } } : {})
};
  • Modify sendMessageWhatsApp() to extract mentioned numbers from the message text, convert them to JIDs, and include them in contextInfo.mentionedJid:
const mentionedJids = [];
const mentionRegex = /@([0-9]+)/g;
let match;
while ((match = mentionRegex.exec(text)) !== null) {
  mentionedJids.push(`${match[1]}@s.whatsapp.net`);
}
const payload = {
  text,
  ...(mentionedJids.length > 0 ? {
    contextInfo: { mentionedJid: mentionedJids }
  } : {})
};
  • Combine the two fixes to support both quote-replies and @mentions:
const payload = {
  text,
  ...(replyToId ? { quoted: { key: { remoteJid: jid, id: replyToId } } } : {}),
  ...(mentionedJids.length > 0 ? {
    contextInfo: { mentionedJid: mentionedJids }
  } : {})
};

Verification

To verify that the fix worked, test the following scenarios:

  • Send a message with a quote-reply using the [[reply_to_current]] tag and verify that the message is sent with the correct quote context.
  • Send a message with an @mention using the @+1234567890 format and verify that the mention is rendered as a tappable link that resolves to the contact name.

Extra Tips

  • Make sure to update the channel-web-*.js and outbound-*.js files with the modified code.
  • Test the fixes thoroughly to ensure that they work correctly in different scenarios.
  • Consider adding additional logging or debugging statements to help diagnose any issues that may arise.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING