Add outbound Weixin native voice-message support#9
Conversation
|
Hi! This PR is exactly what our family needs. We use OpenClaw's DD Agent (an AI companion for our 9-year-old son) through the WeChat channel. TTS voice replies currently arrive as file attachments, which is confusing for a child — he has to tap, open, and play a file instead of just pressing a native voice bubble like he does with family voice messages. The native voice message experience (语音条) is critical for kids — it's the interaction pattern they already understand from WeChat daily use. Is there anything we can help with to get this reviewed and merged? Happy to test on our setup if needed. Thanks for the great work! |
|
Hi, thanks for the PR. I’m interested in understanding how the native voice-message support was validated here. Was this tested end-to-end with a real Weixin client, or is the implementation mainly based on inference from the existing protocol definitions? I also did some experiments based on the 1.x documentation before. Although the voice media type is defined as Would you mind sharing how you verified this behavior? |
|
@zhongruan0522 Good point about real-world validation — I've experienced exactly this gap firsthand. Our setup: OpenClaw DD Agent → WeChat channel → 9-year-old child. TTS voice replies currently come through as file attachments. A kid has to tap → open → play a file. Confusing. We actually had to switch back to text-only because of it, and now our son barely uses the bot. A native voice bubble (语音条) that he can just press and listen to — same as family voice messages — would change everything. I'm happy to:
@cgf120 any guidance before I dive in? |
Summary
This PR adds outbound native Weixin voice-message support.
The protocol layer already defines:
UploadMediaType.VOICE = 4MessageItemType.VOICE = 3VoiceItemwith voice-specific metadataThe README also documents
voice_item/ SILK-based voice messages.However, the current outbound implementation only exposes:
Audio files are currently routed through the generic file path instead of being sent as native Weixin voice messages.
What changed
uploadVoiceToWeixin()usingUploadMediaType.VOICEsendVoiceMessageWeixin()to emitMessageItemType.VOICEsend-media.tsso supported audio files are routed to the voice path instead of always falling back to file attachmentsNotes
.silk→encode_type = 6.mp3/audio/mpeg→encode_type = 7.ogg/audio/ogg→encode_type = 8Why
The protocol and public docs already indicate native voice-message capability, but the outbound implementation was missing the final send/upload path for
VOICE.This PR completes that missing path so outbound behavior matches the documented message schema.