Skip to content

fix(messenger): show flow images and videos to every recipient - #1086

Merged
viethung0o0 merged 1 commit into
mainfrom
fix/messenger-send-media-inline-url
Sep 3, 2026
Merged

fix(messenger): show flow images and videos to every recipient#1086
viethung0o0 merged 1 commit into
mainfrom
fix/messenger-send-media-inline-url

Conversation

@viethung0o0

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the Messenger Send Image and Send Video flow steps showing "Attachment unavailable / this attachment may have been removed or the person who shared it may not have permission" to recipients who have no role on the Page or app, while the same image sent by Send Multiple Images, Send GIF, or the inbox rendered fine.
  • Root cause: the single-media step uploaded the file to /me/message_attachments and sent a media template referencing the returned attachment_id. Meta only renders that reference for people who can already see the Page-owned upload. Reproduced with the raw Graph API on a published Page: the media template payload is accepted but not rendered; the same file sent as a plain attachment { type, payload: { url } } renders for everyone. App permissions, Page publish state, and restrictions were ruled out.
  • Steps without buttons now send the media URL directly (one Send API call, no upload), the same form every other media path in this integration already uses. Steps with buttons keep the existing media-template path unchanged.

Changes

  • integrations/messenger/src/handlers/message/outgoing-message/send-media-v2.ts: new converter with a delivery-mode table — inline (plain URL attachment via getAttachmentTemplate, node quick replies attached) when the step has no buttons, mediaTemplate (delegates to the untouched convertFlowStepMedia) when it has buttons.
  • outgoing-message/index.ts: sendImage / sendVideo route to the new converter (import + one switch case). Rollback is reverting that import.
  • integrations/messenger/__tests__/send-media-v2.test.ts: inline image/video, quick replies present/absent, URL forwarded verbatim, buttons fallback for image/video with quick replies, upload failure on the buttons path still swallowed as before, dispatcher envelope and metadata, mapped Graph fetch error, private comment-anchor routing for inline and template payloads.
  • docs/plans/2026-09-03-messenger-send-media-inline-url.md: root cause, Meta doc references, industry comparison, design, review rounds, follow-ups.

Test plan

  • pnpm lint
  • pnpm --filter @chatbotx.io/integration-messenger check-types
  • Vitest integration-messenger: 32 files / 238 tests
  • Manual on a live Page with a recipient who has no role, on messenger.com and the Messenger app: Send Image without buttons renders; Send Video without buttons renders; Send Image with a button behaves as before; node quick replies still appear under the image

Notes

  • Behaviour change on the no-button path only: a media URL Meta cannot fetch now fails the send (message:failed, error recorded) instead of silently producing a "sent" message with nothing delivered. The buttons path keeps its previous behaviour.
  • One fewer Graph API call per image/video step without buttons.
  • Out of scope, tracked in the plan: image/video with buttons (needs a title source for the generic template), sendAudio / sendFile upload path, Instagram-via-Facebook media template, consolidating the quick-reply spread shared by the media converters.

@github-actions github-actions Bot added the bug Something isn't working as expected label Sep 3, 2026
@viethung0o0
viethung0o0 marked this pull request as ready for review September 3, 2026 18:12
@viethung0o0
viethung0o0 merged commit 095d80b into main Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants