#16940: fix(matrix): send voice messages as native voice bubbles
channel: matrix
size: XS
experienced-contributor
Cluster:
Voice Message Enhancements
## Summary
Voice messages were being sent as generic audio file attachments instead of native voice message bubbles in Matrix clients (Element, FluffyChat, etc.).
## Root Cause
The `audioAsVoice` flag from `ReplyPayload` wasn't being passed through the outbound delivery chain to the Matrix adapter. The underlying `sendMessageMatrix` function already supports `audioAsVoice` and correctly sets `org.matrix.msc3245.voice: {}` when enabled.
## Changes
1. **`types.adapters.ts`**: Added `audioAsVoice?: boolean` to `ChannelOutboundContext`
2. **`deliver.ts`**:
- Added `SendMediaOptions` type with `audioAsVoice`
- Pass `audioAsVoice` in `sendMedia` calls
3. **`extensions/matrix/src/outbound.ts`**: Pass `audioAsVoice` to `sendMessageMatrix`
## Testing
- When TTS is enabled or `asVoice: true` is set in the message tool, audio should now display as native voice message bubbles with waveform in Matrix clients.
Fixes #14225
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Enables voice message bubbles in Matrix clients by threading `audioAsVoice` flag from `ReplyPayload` through the outbound delivery pipeline to the Matrix adapter.
The changes properly add the `audioAsVoice` field to:
- `ChannelOutboundContext` type with clear documentation
- `SendMediaOptions` type for internal routing
- The Matrix adapter's `sendMedia` call chain
The underlying `sendMessageMatrix` function (extensions/matrix/src/matrix/send.ts:96) already supports `audioAsVoice` and correctly applies the MSC3245 voice message spec when enabled. Tests verify the voice message logic works correctly.
One minor consistency improvement: the `sendPayload` handler should also pass `audioAsVoice` explicitly to the context (currently only available via `ctx.payload.audioAsVoice`).
<h3>Confidence Score: 4/5</h3>
- Safe to merge with minor style improvement suggested
- The implementation correctly threads the `audioAsVoice` flag through the delivery pipeline. The underlying Matrix send logic already supports voice messages and has test coverage. One non-critical style improvement suggested for consistency in the `sendPayload` handler.
- No files require special attention
<sub>Last reviewed commit: 65c4884</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#14227: fix(matrix): pass asVoice to audioAsVoice for native voice messages
by tfm-neo-ai · 2026-02-11
92.3%
#14996: feat(matrix): pass asVoice flag through message tool and add wavefo...
by mauldus · 2026-02-12
86.0%
#21193: fix(tts): send voice messages as Opus bubbles on Telegram
by aris-katkova · 2026-02-19
74.1%
#6517: fix(matrix): pass accountId through outbound chain to resolveMatrix...
by saxyguy81 · 2026-02-01
73.4%
#10721: fix for matrix media: destructure downloadContent return value in m...
by mklasen · 2026-02-06
73.1%
#19522: feat(bluebubbles): send TTS as native iMessage voice memos
by mwmacmahon · 2026-02-17
72.5%
#19981: feat(matrix): enable block streaming
by alberthild · 2026-02-18
72.1%
#19439: fix(tts): pass audioAsVoice flag through tool result pipeline
by brandonwise · 2026-02-17
72.0%
#23333: fix(matrix): add accountId routing for multi-account message sending 🤖
by BadTurki · 2026-02-22
71.9%
#13026: matrix: optionally include media metadata in message.read
by yamoroc · 2026-02-10
71.0%