openclaw - ✅(Solved) Fix WhatsApp: Voice messages in groups silently dropped — mention check runs before audio transcription [1 pull requests, 2 comments, 3 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#52213Fetched 2026-04-08 01:14:12
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×2cross-referenced ×1referenced ×1

Error Message

Voice message log flow (stops after inbound, no agent bootstrap):

[whatsapp] Inbound message <groupJid> -> +number (group, audio/ogg; codecs=opus, 121 chars)
[web-auto-reply] group mention debug: wasMentioned=False, body=<media:audio>
[web-auto-reply] inbound web message (processed)
# ...then NOTHING — no agent/embedded bootstrap, no reply, no error

Text message log flow (works correctly):

[whatsapp] Inbound message <groupJid> -> +number (group, 161 chars)
[web-auto-reply] group mention debug: wasMentioned=True
[web-auto-reply] inbound web message (processed)
[agent/embedded] workspace bootstrap (sessionKey=agent:main:whatsapp:group:<jid>)
[whatsapp] Auto-replied to <groupJid>

Root Cause

Actual behavior

  1. Voice message arrives — body is <media:audio>
  2. Group mention gating (applyGroupGating) runs on the raw body — no match for mention patterns
  3. Message is silently dropped — agent is never invoked
  4. No transcription ever runs because the message was filtered before that stage

PR fix notes

PR #62788: fix(whatsapp): add audio preflight transcription for inbound voice notes

Description (problem / solution / changelog)

Summary

WhatsApp voice notes are delivered as <media:audio> placeholders without transcript injection, so the agent never sees the actual spoken content. Telegram and Discord already perform preflight transcription via transcribeFirstAudio before context assembly — this adds the same behavior for WhatsApp.

What this PR does

  • Adds preflight audio transcription in enrichInboundMessage() — after media download, before agent handoff
  • Uses the provider-agnostic transcribeFirstAudio pipeline (works with OpenAI, Groq, local Whisper, or any configured provider)
  • Respects existing tools.media.audio config (enabled, echoTranscript, echoFormat)
  • Clears media fields after successful transcription (audio consumed as text)
  • Graceful fallback on failure — keeps <media:audio> placeholder, logs error

How it differs from #54038

PR #54038 calls transcribeOpenAiCompatibleAudio directly, which only works with OpenAI-compatible providers and hardcodes an OPENAI_API_KEY check. This PR uses transcribeFirstAudio (same as Telegram and Discord), which routes through the general media understanding pipeline and supports any configured provider.

Files changed

  • extensions/whatsapp/src/inbound/preflight-audio.runtime.ts (new) — thin runtime wrapper, same pattern as Telegram and Discord
  • extensions/whatsapp/src/inbound/monitor.ts — preflight transcription + echo in enrichInboundMessage()
  • extensions/whatsapp/src/inbound.media.test.ts — 4 new regression tests

Test plan

  • Inbound .ogg voice note → body is transcript, not <media:audio>
  • Transcription disabled in config → body stays <media:audio>, transcribeFirstAudio not called
  • echoTranscript: true → transcript echoed back to chat via sock.sendMessage
  • echoTranscript: false (default) → no echo sent
  • All 427 existing WhatsApp extension tests pass (53 test files, zero failures)

Validation

pnpm exec vitest run extensions/whatsapp/src/inbound.media.test.ts
pnpm exec vitest run --config vitest.extension-whatsapp.config.ts

Closes #44908, closes #54030, closes #52213

🤖 Generated with Claude Code

Changed files

  • extensions/whatsapp/src/inbound.media.test.ts (modified, +187/-15)
  • extensions/whatsapp/src/inbound/monitor.ts (modified, +43/-0)
  • extensions/whatsapp/src/inbound/preflight-audio.runtime.ts (added, +9/-0)

Code Example

[whatsapp] Inbound message <groupJid> -> +number (group, audio/ogg; codecs=opus, 121 chars)
[web-auto-reply] group mention debug: wasMentioned=False, body=<media:audio>
[web-auto-reply] inbound web message (processed)
# ...then NOTHING — no agent/embedded bootstrap, no reply, no error

---

[whatsapp] Inbound message <groupJid> -> +number (group, 161 chars)
[web-auto-reply] group mention debug: wasMentioned=True
[web-auto-reply] inbound web message (processed)
[agent/embedded] workspace bootstrap (sessionKey=agent:main:whatsapp:group:<jid>)
[whatsapp] Auto-replied to <groupJid>

---

{
  channels: {
    whatsapp: {
      selfChatMode: true,
      groupPolicy: "open",
      groups: {
        "*": { requireMention: true },
        "<groupJid>": { requireMention: false }  // also tried this — no help
      }
    }
  },
  agents: {
    list: [{
      id: "main",
      groupChat: {
        mentionPatterns: ["botname"],
        historyLimit: 50
      }
    }]
  },
  tools: {
    media: {
      audio: {
        enabled: true,
        models: [{
          type: "cli",
          command: "/path/to/whisper-transcribe.sh",
          args: ["{{MediaPath}}"],
          timeoutSeconds: 60
        }]
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw: 2026.3.13
  • macOS (arm64), Node v25.6.1
  • WhatsApp channel (personal number, selfChatMode: true)
  • Audio transcription: whisper-cpp CLI via tools.media.audio.models

Problem

Voice messages in a WhatsApp group are received but never processed. Text messages in the same group work perfectly. The agent is never invoked for voice messages.

Expected behavior

Voice messages should be transcribed first, then the mention check should run on the transcribed text. If the user says the bot name in a voice message, it should trigger the same as typing the name.

Actual behavior

  1. Voice message arrives — body is <media:audio>
  2. Group mention gating (applyGroupGating) runs on the raw body — no match for mention patterns
  3. Message is silently dropped — agent is never invoked
  4. No transcription ever runs because the message was filtered before that stage

Reproduction

  1. Set up WhatsApp with a group, requireMention: true
  2. Configure agents.list[].groupChat.mentionPatterns
  3. Configure tools.media.audio.models with a working CLI transcription tool
  4. Send a text message mentioning the bot name in the group → works, agent responds
  5. Send a voice message mentioning the bot name → no response, no error in logs

Additional observations

  • Even with requireMention: false for the specific group, voice messages still produce no response
  • /activation always sent to the group also does not help — voice messages still get no reply
  • The group mention debug log shows wasMentioned: false for all voice messages
  • DM voice messages also exhibit issues — agent bootstraps but may not send reply (possibly related)
  • Text messages in the same group, same config, same sender all work perfectly

Logs

Voice message log flow (stops after inbound, no agent bootstrap):

[whatsapp] Inbound message <groupJid> -> +number (group, audio/ogg; codecs=opus, 121 chars)
[web-auto-reply] group mention debug: wasMentioned=False, body=<media:audio>
[web-auto-reply] inbound web message (processed)
# ...then NOTHING — no agent/embedded bootstrap, no reply, no error

Text message log flow (works correctly):

[whatsapp] Inbound message <groupJid> -> +number (group, 161 chars)
[web-auto-reply] group mention debug: wasMentioned=True
[web-auto-reply] inbound web message (processed)
[agent/embedded] workspace bootstrap (sessionKey=agent:main:whatsapp:group:<jid>)
[whatsapp] Auto-replied to <groupJid>

Config (sanitized)

{
  channels: {
    whatsapp: {
      selfChatMode: true,
      groupPolicy: "open",
      groups: {
        "*": { requireMention: true },
        "<groupJid>": { requireMention: false }  // also tried this — no help
      }
    }
  },
  agents: {
    list: [{
      id: "main",
      groupChat: {
        mentionPatterns: ["botname"],
        historyLimit: 50
      }
    }]
  },
  tools: {
    media: {
      audio: {
        enabled: true,
        models: [{
          type: "cli",
          command: "/path/to/whisper-transcribe.sh",
          args: ["{{MediaPath}}"],
          timeoutSeconds: 60
        }]
      }
    }
  }
}

Suggested fix

Audio transcription (or at minimum, audio understanding) should run before the group mention gating check in applyGroupGating, so the transcribed text can be pattern-matched for mentions.

extent analysis

Fix Plan

To resolve the issue, we need to modify the applyGroupGating function to run audio transcription before checking for mentions. Here are the steps:

  1. Modify the applyGroupGating function:

    • Check if the incoming message is an audio message.
    • If it's an audio message, run the audio transcription using the configured CLI tool.
    • Use the transcribed text for the mention check.
  2. Update the tools.media.audio.models configuration:

    • Ensure the transcription tool is correctly configured and working.
  3. Implement a fallback for transcription failures:

    • Handle cases where transcription fails or times out.

Example Code (Node.js):

const applyGroupGating = async (message) => {
  if (message.type === 'audio') {
    // Run audio transcription
    const transcribedText = await transcribeAudio(message);
    message.text = transcribedText;
  }

  // Run mention check on the transcribed text (if audio) or original text
  const mentionPatterns = getMentionPatterns();
  const isMentioned = mentionPatterns.some((pattern) => message.text.includes(pattern));

  if (isMentioned) {
    // Invoke the agent
    invokeAgent(message);
  }
};

const transcribeAudio = async (audioMessage) => {
  // Use the configured CLI transcription tool
  const transcriptionTool = getTranscriptionTool();
  const args = [audioMessage.mediaPath];
  const result = await runCliTool(transcriptionTool.command, args, transcriptionTool.timeoutSeconds);
  return result.stdout;
};

Verification

To verify that the fix worked:

  1. Send a voice message mentioning the bot name in the group.
  2. Check the logs for the wasMentioned flag and agent invocation.
  3. Ensure the agent responds correctly to the voice message.

Extra Tips

  • Test the transcription tool separately to ensure it's working correctly.
  • Implement error handling for transcription failures and timeouts.
  • Consider adding a cache for transcribed audio messages to avoid repeated transcription.

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…

FAQ

Expected behavior

Voice messages should be transcribed first, then the mention check should run on the transcribed text. If the user says the bot name in a voice message, it should trigger the same as typing the name.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix WhatsApp: Voice messages in groups silently dropped — mention check runs before audio transcription [1 pull requests, 2 comments, 3 participants]