Skip to content

feat(chatwoot-adapter): forward reply quotes and relay voice notes (#606, #607)#24

Merged
rmyndharis merged 1 commit into
mainfrom
feat/chatwoot-voice-quote
Jul 3, 2026
Merged

feat(chatwoot-adapter): forward reply quotes and relay voice notes (#606, #607)#24
rmyndharis merged 1 commit into
mainfrom
feat/chatwoot-voice-quote

Conversation

@rmyndharis

Copy link
Copy Markdown
Owner

Resolves rmyndharis/OpenWA#606 and rmyndharis/OpenWA#607.

Summary

Two gaps in the WhatsApp ↔ Chatwoot relay: replies lost their quote context, and voice notes didn't move in either direction. This wires both, plus generalises the outbound relay so any attachment (not just text) is delivered.

Reply / quote context (rmyndharis/OpenWA#606)

Inbound messages are now posted with source_id = the WhatsApp message id, and a reply adds content_attributes.in_reply_to_external_id = the quoted message's id (read from the quotedMessage the host already puts on the inbound hook). Chatwoot resolves the two and renders the quoted bubble — the same threading its native WhatsApp integration uses. A short reply like .. now keeps the message it answered instead of showing alone.

Voice notes (rmyndharis/OpenWA#607)

Inbound: a voice message uploads through postMedia with is_voice_message=true and a voice.ogg filename, so Chatwoot shows a playable voice bubble. If the voice blob was dropped for size (media.omitted), the relay posts a short placeholder (🎤 Voice message) instead of an empty message.

Outbound: the relay no longer bails when an agent reply has no text. An attachment is mapped to a conversation.send envelope — audio → voice (PTT), image → image, video → video, anything else → file — with the Chatwoot attachment URL as mediaUrl and the message text (if any) as the caption. The host fetches the URL through its SSRF-guarded media-by-URL path, so no bytes cross the sandbox. Previously every attachment-only reply was silently dropped.

Outbound voice/media sends rely on conversation.send media support, so minOpenWAVersion moves to 0.8.3 and the plugin to 0.2.0.

Notes

  • Audio attachments relay as PTT voice notes: the common agent action is recording a voice reply, and the Chatwoot webhook carries no reliable voice-vs-file discriminator. A plain uploaded audio file is the rare exception.
  • Reply threading resolves when the quoted message was itself relayed inbound (it then has a matching source_id). A quote of an agent's outbound message won't thread, since that message originated in Chatwoot.

Tests

New coverage for: quote forwarding (source_id + in_reply_to_external_id), inbound voice → is_voice_message/voice.ogg, omitted-blob placeholder, and outbound audio→voice / image→image attachment relay. Full suite green (188 tests across all plugins), tsc --noEmit clean, plugin packages and the catalog is regenerated.

…606, #607)

Reply/quote context (#606): every relayed message now carries its WhatsApp
id as source_id, and a reply carries content_attributes.in_reply_to_external_id,
so a swipe-to-reply renders its quoted bubble in Chatwoot instead of a bare line.

Voice notes both ways (#607): inbound voice notes upload as Chatwoot voice
messages (is_voice_message, voice.ogg), and a note whose blob was dropped for
size posts a short placeholder instead of an empty bubble. Outbound audio
attachments relay to WhatsApp as PTT voice notes via the new conversation.send
'voice' type; image/video/file attachments relay as their native media type —
previously any attachment without text was silently dropped.

Bumps minOpenWAVersion to 0.8.3 (the outbound 'voice'/media send needs it) and
the plugin to 0.2.0.
@rmyndharis rmyndharis merged commit e4e3241 into main Jul 3, 2026
1 check passed
@rmyndharis rmyndharis deleted the feat/chatwoot-voice-quote branch July 3, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chatwoot-adapter: WhatsApp reply/quote context not forwarded to Chatwoot (shows only reply text)

1 participant