fix(broadcasts): media-template broadcasts fail at Meta (#131008)#69
Merged
Conversation
…roadcasts A media-header template stores its image in message_templates.header_media_library_id. The template test-send resolved the header from that column, but the broadcast path only looked at broadcast.media_library_id and never fetched the template's own image. When a user broadcast a media-header template, no header component was built and Meta rejected the send with #131008 (missing required parameter) — Pending then Failed, even though Send Test worked. Backend: fetch t.header_media_library_id in the /send and /test SELECTs and fall back to it (broadcast.media_library_id || template.header_media_library_id) when resolving the header media and stamping template_meta. Frontend: auto-prefill the broadcast media picker with the template's saved header image so users don't re-select it, the preview renders, and Send isn't blocked. Signed-off-by: sthirumalairajan2212 <92260025+sthirumalairajan2212@users.noreply.github.com>
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.
Problem
Broadcasting an approved media-header template (image from the Media Library) fails immediately — status goes
Pending → Failedwith no message sent — even though Send Test of the same template delivers fine with the image.Root cause
A media-header template stores its image in
message_templates.header_media_library_id.broadcast.media_library_idand never fetched the template's ownheader_media_library_id. The frontend didn't prefill it either, so it was empty →buildTemplateComponentsbuilt no header component → Meta rejected with #131008 ("Required parameter is missing").Fix
routes/broadcasts.js, both/sendand/test): fetcht.header_media_library_idand fall back to it (broadcast.media_library_id || template.header_media_library_id) when resolving the header media and stampingtemplate_meta. A template broadcast now resolves the header exactly like a test-send.BulkMessagePage.jsx): auto-prefill the media picker with the template's saved header image, so users don't re-select it, the preview renders, and the Send button isn't blocked.Test
node -con broadcasts.js and esbuild parse on BulkMessagePage.jsx pass.