Skip to content

fix(facebook): multi-image posts publish as text-only#59

Merged
paulocastellano merged 1 commit into
mainfrom
fix/facebook-multi-image-form-encoding
May 22, 2026
Merged

fix(facebook): multi-image posts publish as text-only#59
paulocastellano merged 1 commit into
mainfrom
fix/facebook-multi-image-form-encoding

Conversation

@paulocastellano
Copy link
Copy Markdown
Contributor

Summary

  • Facebook Graph API calls now use application/x-www-form-urlencoded via asForm() instead of JSON
  • Fixes multi-image Page posts that published caption only: message was accepted but attached_media[*] was silently ignored
  • Adds tests asserting form encoding on /photos and /feed (including attached_media payload shape)

Root cause

Laravel's HTTP client defaults to JSON for Http::post($url, $array). Facebook accepts message in JSON but drops bracket-style attached_media keys, so 2+ image posts looked successful in TryPost while Facebook showed text only.

Test plan

  • php artisan test --compact tests/Feature/Services/Social/FacebookPublisherTest.php
  • Republish a 2-image Facebook post and confirm photos appear on the Page

Made with Cursor

Multi-image posts were published as text-only because Laravel sent
attached_media as JSON; Facebook accepts message but drops attachments.
Use asForm() for all FacebookPublisher Graph API calls.

Co-authored-by: Cursor <cursoragent@cursor.com>
@paulocastellano paulocastellano merged commit ade899c into main May 22, 2026
2 checks passed
@paulocastellano paulocastellano deleted the fix/facebook-multi-image-form-encoding branch May 22, 2026 00:17
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.

1 participant