openclaw - 💡(How to fix) Fix [WeChat] TTS should send voice messages instead of audio file attachments [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#56225Fetched 2026-04-08 01:43:21
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
subscribed ×1
RAW_BUFFERClick to expand / collapse

Problem

When TTS is enabled with the WeChat (openclaw-weixin) channel, generated audio is sent as a file attachment rather than a native voice message (语音条).

On WeChat, there's a clear UX difference:

  • Voice message (type 3): Plays inline in the chat as a voice note, same as how friends send voice messages
  • File attachment: Shows as a downloadable file, requires tapping to open/play

Technical Context

The @tencent-weixin/openclaw-weixin plugin (v2.1.1) already supports voice message sending:

  • MessageItemType.VOICE: 3 is defined in src/api/types.ts
  • silk-transcode.ts handles SILK encoding (WeChat's voice codec)
  • upload.ts has voice upload support via UploadMediaType.VOICE: 4

However, the TTS pipeline ( ts tool → MEDIA: directive → channel send) routes through sendWeixinMediaFile() which checks MIME type:

  • ideo/* → video message
  • image/* → image message
  • everything else → file message ← TTS output (MP3/OGG) lands here

Proposed Solution

Add a [[audio_as_voice]] or similar directive that the WeChat channel plugin can detect, and route the audio through the voice message path (SILK transcode + voice upload) instead of the generic file path.

Similar to how Telegram already handles this — the TTS tool emits [[audio_as_voice]] when output is Telegram-compatible, and Telegram sends it as an Opus voice bubble.

Environment

  • OpenClaw: 2026.3.24
  • openclaw-weixin: 2.1.1
  • TTS provider: MiMo-V2-TTS (OpenAI-compatible)

extent analysis

Fix Plan

To fix the issue, we need to add a new directive [[audio_as_voice]] to route TTS audio through the voice message path. Here are the steps:

  • Update the sendWeixinMediaFile() function to check for the [[audio_as_voice]] directive
  • If the directive is present, transcode the audio to SILK format using silk-transcode.ts
  • Upload the transcoded audio as a voice message using upload.ts with UploadMediaType.VOICE

Example Code

// Update sendWeixinMediaFile() function
if (message.includes('[[audio_as_voice]]')) {
  // Transcode audio to SILK format
  const silkAudio = await transcodeToSilk(audioBuffer);
  // Upload transcoded audio as voice message
  await uploadVoiceMessage(silkAudio);
} else {
  // Handle other media types
}

// Add transcodeToSilk() function
async function transcodeToSilk(audioBuffer) {
  // Use silk-transcode.ts to transcode audio to SILK format
  const silkTranscoder = new SilkTranscoder();
  return silkTranscoder.transcode(audioBuffer);
}

// Add uploadVoiceMessage() function
async function uploadVoiceMessage(silkAudio) {
  // Use upload.ts to upload transcoded audio as voice message
  const uploadClient = new UploadClient();
  return uploadClient.uploadVoiceMessage(silkAudio, UploadMediaType.VOICE);
}

Verification

To verify the fix, send a TTS message with the [[audio_as_voice]] directive and check that it is sent as a native voice message on WeChat.

Extra Tips

  • Make sure to update the @tencent-weixin/openclaw-weixin plugin to the latest version to ensure compatibility with the new directive.
  • Test the fix with different audio formats (e.g. MP3, OGG) to ensure that the transcoding and uploading process works correctly.

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