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
| Publishing | Yes |
|---|---|
| Scheduling | Yes |
| Comments | Yes |
| Direct messages | Yes |
| Mentions | Partly |
| Reviews | No |
| Analytics | Yes |
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.
| Key | Type | What it does |
|---|---|---|
content_type | reel | stories | reel 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. |
link | URL | Link attached to a text post or an album. |
cta_type, cta_link | string, URL | Call-to-action button on text, link and album posts. Send both or neither. |
min_age, max_age | 13-65 | Audience age targeting (text, link, photo, video, album). |
countries | string[] | Audience targeting by ISO alpha-2 country codes. |
place | digits | Location Page id (text, link, photo, video, album, Reel). |
alt_text | string | Alt text of a single photo. |
title | string | Title of a single video or Reel. |
cover_url | URL | Single video or Reel: JPG or PNG cover up to 10 MB, set after the upload (best effort). |
share_to_feed | boolean | Reels: also show the Reel in the Page feed. Default true. |
no_story | boolean | Single photo or video: do not show it in the Page's story. |
content_category, content_tags, embeddable, secret, social_actions | various | Single 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.
| Code | Meaning |
|---|---|
platform.facebook.no_pages | The login manages no Page this app can use. |
platform.facebook.no_assignable_pages | Every Page of the login already belongs to another brand. |
billing.brands_limit | No 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.receiveddm.sent(also replies typed in Messenger or Meta Business Suite)dm.postbackdm.referraldm.status.delivered/ dm.status.readpage.removed
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.
- Create an app at developers.facebook.com → My Apps → Create app → type Business.
- Add the Facebook Login for Business product to the app.
- Paste the Callback address shown below into Valid OAuth Redirect URIs.
- Under Webhooks, subscribe with the Webhook address below and your META_WEBHOOK_VERIFY_TOKEN.
- App settings → Basic: add Privacy Policy URL, Terms URL, User data deletion URL, app icon and category.
- 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_managementpublic_profilepages_show_listpages_read_engagementpages_manage_postspages_read_user_contentpages_manage_engagementpages_messagingpages_manage_metadataread_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)
- Business verification of your company in Meta Business Manager (documents + domain).
- App Review: request Advanced Access for every permission listed below, each with a screencast of the feature and test instructions.
- 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.