feat(chatwoot-adapter): forward reply quotes and relay voice notes (#606, #607)#24
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 addscontent_attributes.in_reply_to_external_id= the quoted message's id (read from thequotedMessagethe 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
voicemessage uploads throughpostMediawithis_voice_message=trueand avoice.oggfilename, 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.sendenvelope —audio → voice(PTT),image → image,video → video, anything else →file— with the Chatwoot attachment URL asmediaUrland 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 onconversation.sendmedia support, sominOpenWAVersionmoves to 0.8.3 and the plugin to 0.2.0.Notes
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 --noEmitclean, plugin packages and the catalog is regenerated.