Repository navigation
send: keep the edited content's type for newsletter edits (fixes media caption edits in channels, error 479) - #4
Open
freedomcomedelivery wants to merge 1 commit into
Conversation
sendNewsletter computes the node "type" attribute from the outer EditedMessage wrapper, which getTypeFromMessage maps to "text", and only then unwraps the edited content into the <plaintext> node. A caption edit of an image/video/document in a newsletter therefore goes out as type="text" with mediatype="image" (etc.) inside, and the server rejects it with "server returned error 479". Text edits are unaffected because their type is "text" anyway. Recompute the type after unwrapping, so a media caption edit is sent as type="media" exactly like the original send. Verified through WAHA/GOWS against a real newsletter: image, video and text edits are accepted and rendered, and no media handle or re-upload is needed for that. Fixes devlikeapro/waha#1852. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
freedomcomedelivery
force-pushed
the
newsletter-edit-type
branch
from
October 21, 2026 18:05
cfc6a23 to
bb8f2a2
Compare
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.
Summary
Editing the caption of an image/video/document message in a newsletter (channel) fails with
server returned error 479, while editing a text message in the same newsletter works. This is the root cause behind devlikeapro/waha#1852 ("[GOWS] - Edit message with image not working in Channels") and the same symptom as tulir/whatsmeow discussion tulir#697.Root cause
In
sendNewsletter()the nodetypeattribute is computed from the outerEditedMessagewrapper before the edited content is unwrapped into the<plaintext>node.getTypeFromMessage()has no case forEditedMessage, so the wrapper falls through to"text". A media caption edit therefore goes out aswhereas the original media send is
type="media". In 1:1 chats and groups this mismatch is invisible (the content is encrypted), but a newsletter message is plaintext and the server rejects the mismatch with 479.Fix
Recompute
attrs["type"]from the unwrapped edited content. Text edits are unaffected (their type is"text"either way); media caption edits now go out astype="media", exactly like the original send.What was tried and did not help
Before finding the cause I checked the two obvious suspects, both still returned 479:
ImageMessage/VideoMessagewith the full media reference of the original (URL, directPath, fileSha256, fileLength, …) instead of caption + contextInfo only;UploadNewsletterand passing the new handle asSendRequestExtra.MediaHandle(media_idattribute), as suggested in discussion Editing Newsletter Caption (ImageMessage) returns 479 tulir/whatsmeow#697.Neither is needed. With this change the caption-only edited message (as built by WAHA/GOWS today) is accepted.
Testing
Built GOWS (
gows-plus@ 120a614, the commit behind the WAHA 2026.9.2 image) against this fork at the pinned commit plus this patch, and ran it as the engine of WAHA 2026.9.2 (devlikeapro/waha:gows-2026.9.2) with a real WhatsApp account that is an admin of a newsletter:PUT /api/{session}/chats/{chatId}/messages/{id}on an image message → 200, the new caption is shown in the channel on the phone;Without the patch every media edit above fails with
2 UNKNOWN: server returned error 479.Notes
tulir/whatsmeow(send.go,sendNewsletter); I have the identical change ready for an upstream PR.gofmt,go build ./...andgo vetare clean.