#14227: fix(matrix): pass asVoice to audioAsVoice for native voice messages
channel: matrix
stale
Cluster:
Voice Message Enhancements
## Description
Fixes voice messages being sent as audio file attachments instead of native voice message bubbles in Matrix clients.
## Root Cause
The `sendMedia` adapter in `outbound.ts` was not passing the `asVoice` parameter to `sendMessageMatrix`, preventing the `org.matrix.msc3245.voice` flag from being set in the message content.
## Changes
- Added `asVoice` extraction from sendMedia parameters
- Passed `audioAsVoice: asVoice` to the send function
## Testing
1. Configure TTS with ElevenLabs and `auto: inbound`
2. Send a voice message or use `message` tool with `asVoice: true`
3. Voice messages should now display as native voice bubbles in Element/FluffyChat
## Related Issues
- Fixes #14226
- Related to #11654 (similar issue for Telegram)
## Checklist
- [x] Bug fix (non-breaking change)
- [x] Single file change
- [x] No breaking changes
---
**Disclaimer:** This pull request was created by an AI assistant (Neo/Kimi) on behalf of a human user. The code changes were authored by AI based on human direction.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Fixes the Matrix outbound adapter to forward the `asVoice` parameter as `audioAsVoice` to `sendMessageMatrix`, enabling native voice message bubbles (via `org.matrix.msc3245.voice`) instead of plain audio file attachments.
- Extracted `asVoice` from `sendMedia` destructured params and passed it as `audioAsVoice: asVoice` to the send function
- The inbound reply path (`deliverMatrixReplies` in `replies.ts`) already passed `audioAsVoice` correctly; this fix addresses the outbound adapter path used by the generic delivery pipeline and message tool
- Note: `ChannelOutboundContext` type does not include `asVoice`, so the value is only available at runtime when callers pass extra properties — this is a pre-existing type gap shared with other channels
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge — minimal, well-scoped bug fix with no behavioral risk to non-voice code paths.
- Single-file, two-line change that correctly wires up an existing parameter (`audioAsVoice`) that was already supported by `sendMessageMatrix`. The `asVoice` value defaults to `undefined` when not provided, preserving backward compatibility. The only minor concern is that `ChannelOutboundContext` doesn't include `asVoice` in its type definition, but this is a pre-existing gap and doesn't affect runtime correctness.
- No files require special attention.
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#16940: fix(matrix): send voice messages as native voice bubbles
by zerone0x · 2026-02-15
92.3%
#14996: feat(matrix): pass asVoice flag through message tool and add wavefo...
by mauldus · 2026-02-12
85.8%
#21193: fix(tts): send voice messages as Opus bubbles on Telegram
by aris-katkova · 2026-02-19
78.1%
#19439: fix(tts): pass audioAsVoice flag through tool result pipeline
by brandonwise · 2026-02-17
76.5%
#10721: fix for matrix media: destructure downloadContent return value in m...
by mklasen · 2026-02-06
75.0%
#15394: telegram: treat mp3 as voice-compatible when asVoice=true
by SnugMorg · 2026-02-13
74.7%
#12700: fix(tts): deliver WhatsApp voice as opus bubble instead of MP3 (#12...
by lailoo · 2026-02-09
74.0%
#23333: fix(matrix): add accountId routing for multi-account message sending 🤖
by BadTurki · 2026-02-22
74.0%
#6517: fix(matrix): pass accountId through outbound chain to resolveMatrix...
by saxyguy81 · 2026-02-01
74.0%
#21110: fix(tts): deliver audio via structured mediaUrl instead of MEDIA: t...
by hydro13 · 2026-02-19
73.4%