Platforms / Facebook

Facebook API

Post to Facebook Pages and handle Page comments and Messenger conversations.

At a glance

Platform id
facebook
Connects
Page
Sign-in
OAuth: the user approves on the platform's own page
Post types
Text · Link · Images (album up to 10) · Video · Reel · Story · Link carousel

Capabilities

What Facebook supports here
PublishingYes
SchedulingYes
CommentsYes
Direct messagesYes
MentionsPartly
ReviewsNo
AnalyticsYes

Required on every post

  • Text or media. A Story is exactly one photo or video.

Options

Send these in platform_data.facebook on the post, or flat in a target's own platform_data (the target's keys win). See Publishing.

platform_data options for Facebook
KeyTypeWhat it does
content_typereel | storiesreel publishes the video as a Reel (9:16, 3-90 s). stories (plural) publishes one photo or video as a 24-hour Page Story with no caption, link or targeting. Anything else is a normal post.
linkURLLink attached to a text post or an album.
cta_type, cta_linkstring, URLCall-to-action button on text, link and album posts. Send both or neither.
min_age, max_age13-65Audience age targeting (text, link, photo, video, album).
countriesstring[]Audience targeting by ISO alpha-2 country codes.
placedigitsLocation Page id (text, link, photo, video, album, Reel).
alt_textstringAlt text of a single photo.
titlestringTitle of a single video or Reel.
cover_urlURLSingle video or Reel: JPG or PNG cover up to 10 MB, set after the upload (best effort).
share_to_feedbooleanReels: also show the Reel in the Page feed. Default true.
no_storybooleanSingle photo or video: do not show it in the Page's story.
content_category, content_tags, embeddable, secret, social_actionsvariousSingle video settings, sent to Facebook as given.
child_attachments{ link, name?, description?, picture? }[]Link carousel of 2 to 10 cards, with no media. multi_share_optimized and multi_share_end_card tune it.

Limits

  • 63,206 characters per post. Albums up to 10 images; one video per post.
  • This server caps each Page at 25 posts an hour and 100 a day.

Text over the limit fails validation before anything is sent. The caps of this server are explained in Rate limits.

Good to know

  • Each Page becomes its own account; one login can add several Pages, and one brand can hold several Pages. Page tokens do not expire: reconnect only if access is revoked.
  • Pages owned through a Business Portfolio are listed too (business_management). Accounts connected before that scope was added should reconnect.
  • Personal profiles cannot be posted to (Meta removed that API).
  • Messenger replies work only within 24 hours of the person's last message.
  • Comments: reply, hide, delete, like, and one private reply per comment within 7 days. An edited comment arrives again as comment.received.
  • The text of a published text or photo post can be edited. Videos, Reels and Stories keep their published text: an edit skips them and lists them in not_updated_account_ids.
  • Page reviews cannot be read: Meta removed that API in Graph API v22.0.
  • Page insights need the Analyze task on the Page for the person who connects it.

Publish with the API

curl https://api.zaynstack.com/v1/posts \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from SocialWire",
    "media": [{ "type": "image", "source_type": "url", "source": "https://example.com/file.jpg" }],
    "targets": [{ "account_id": "<Facebook account id>" }],
    "publish_now": true
  }'

An operation Facebook cannot do answers 501 resource.not_supported. Agents can do the same through the MCP server.

Connection errors

A connection that fails comes back to your redirect_uri with status=error, error=<code> and error_description, or as the error of the connect call. All codes: Connect accounts.

Connection error codes for Facebook
CodeMeaning
platform.facebook.no_pagesThe login manages no Page this app can use.
platform.facebook.no_assignable_pagesEvery Page of the login already belongs to another brand.
billing.brands_limitNo brand_id was sent, so a new brand was needed, and the plan has no room for another brand.

Webhook events

Every platform sends the post.* and account.* events. Facebook also sends:

  • comment.received (also for edited comments)
  • dm.received
  • dm.sent (also replies typed in Messenger or Meta Business Suite)
  • dm.postback
  • dm.referral
  • dm.status.delivered / dm.status.read
  • page.removed

Webhook events and their payloads

Not supported yet

  • Posting to personal profiles.
  • Reading Page reviews (recommendations).
  • Editing the text of published videos, Reels and Stories.

Developer setup (self-hosting)

Only the operator of this server does this, once. Users then just click Connect.

  1. Create an app at developers.facebook.com → My Apps → Create app → type Business.
  2. Add the Facebook Login for Business product to the app.
  3. Paste the Callback address shown below into Valid OAuth Redirect URIs.
  4. Under Webhooks, subscribe with the Webhook address below and your META_WEBHOOK_VERIFY_TOKEN.
  5. App settings → Basic: add Privacy Policy URL, Terms URL, User data deletion URL, app icon and category.
  6. Put the app ID and secret into FACEBOOK_APP_ID / FACEBOOK_APP_SECRET.
Callback address
https://api.zaynstack.com/api/connect/facebook/callback
Webhook address
https://api.zaynstack.com/api/hooks/facebook
Server variables
FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, META_WEBHOOK_VERIFY_TOKEN
Developer console
Facebook developer console

Permissions requested

  • business_management
  • public_profile
  • pages_show_list
  • pages_read_engagement
  • pages_manage_posts
  • pages_read_user_content
  • pages_manage_engagement
  • pages_messaging
  • pages_manage_metadata
  • read_insights

When a reconnect grants fewer permissions than before, an account.updated event with change permissions_reduced is sent. Accounts connected before a permission was added keep working but must reconnect to use the features it unlocks.

Before anyone can connect (review)

  1. Business verification of your company in Meta Business Manager (documents + domain).
  2. App Review: request Advanced Access for every permission listed below, each with a screencast of the feature and test instructions.
  3. Switch the app to Live mode after approval.

Typical wait: Usually 1-3 weeks including business verification. Until then the app works for your own accounts and the testers you add in the console.

Other platforms

Free to start

Your next post can go everywhere at once.

No card. Connect a profile, send a post, see it land.