> ## Documentation Index
> Fetch the complete documentation index at: https://docs.social-api.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Facebook

> Connect and interact with Facebook Pages via the Meta Graph API.

<Badge>Available</Badge>

**Managed connector** - [SocialAPI](https://social-api.ai) handles the Meta App and platform app review for you. No customer-side Meta for Developers registration required. See [Platform credentials](/guides/platform-credentials).

Facebook Pages are fully supported. The connector uses the Meta Graph API for posts, comments, DMs (Messenger), and mentions.

## At a glance

| Field         | Value                                                    |
| ------------- | -------------------------------------------------------- |
| Platform slug | `facebook`                                               |
| Auth type     | OAuth 2.0 (Meta)                                         |
| API           | Meta Graph API                                           |
| Best for      | Page-level engagement: post and reply on Facebook Pages. |

## Capabilities

| Feature                               | Supported | Notes                                                                                                                                               |
| ------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| List posts                            | Yes       | Page feed posts                                                                                                                                     |
| Comments                              | Yes       | Scoped to a specific post                                                                                                                           |
| Reply to comment                      | Yes       |                                                                                                                                                     |
| Private reply                         | Yes       | Sends a one-time DM to the commenter                                                                                                                |
| Comment replies (thread)              | Yes       | Fetch the reply thread under a comment                                                                                                              |
| Moderate comment (hide/unhide/delete) | Yes       |                                                                                                                                                     |
| Toggle post comments                  | No        | Not supported by Facebook Graph API                                                                                                                 |
| DMs                                   | Yes       | Via Messenger (24-hour messaging window)                                                                                                            |
| Send DM                               | Yes       | Text and/or media attachment (`attachment_url`)                                                                                                     |
| Send DM attachment                    | Yes       | Image, video, audio, or file via `attachment_url` (type inferred from URL extension, max 25 MB), or by `attachment_id` (requires `attachment_type`) |
| Get DM thread by user                 | Yes       |                                                                                                                                                     |
| Reviews                               | No        | Deprecated in Graph API v22.0                                                                                                                       |
| Mentions                              | Yes       | Posts where the Page is tagged                                                                                                                      |
| Reply to mention                      | Yes       | Posts a public comment reply on a mention (post or comment mention)                                                                                 |
| Like/unlike comment                   | Yes       | Page can like or unlike a comment                                                                                                                   |
| Create post                           | Yes       | Text, photos, links, videos, Reels (set `content_type: reel` in platform\_data)                                                                     |
| Delete post                           | Yes       |                                                                                                                                                     |

## Connecting

```bash theme={null}
curl -X POST https://api.social-api.ai/v1/accounts/connect \
  -H "Authorization: Bearer $SOCAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "facebook",
    "redirect_uri": "https://app.example.com/oauth/callback",
    "state": "session_abc123"
  }'
```

Response:

```json theme={null}
{
  "auth_url": "https://www.facebook.com/v25.0/dialog/oauth?client_id=...&state=...",
  "state": "4a8f2c1e9b3d7f06a5c2e8b4d1f3a7e2"
}
```

Redirect your user to `auth_url`. After they authorize, SocialAPI exchanges the code with Facebook and redirects the user to your `redirect_uri` with the connection result. See [OAuth flows](/guides/oauth#step-3-receive-the-result-at-your-redirect_uri) for the redirect parameters.

## Reading samples

### List posts

```bash theme={null}
curl "https://api.social-api.ai/v1/accounts/{id}/posts?limit=10" \
  -H "Authorization: Bearer $SOCAPI_KEY"
```

Sample response:

```json theme={null}
{
  "data": [
    {
      "id": "123456789_987654321",
      "platform": "facebook",
      "caption": "Check out our new product!",
      "media_type": "status",
      "permalink": "https://www.facebook.com/123456789/posts/987654321",
      "timestamp": "2026-03-01T12:00:00Z",
      "like_count": 0,
      "comments_count": 0,
      "account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J"
    }
  ],
  "count": 1
}
```

### List comments on a post

```bash theme={null}
curl "https://api.social-api.ai/v1/accounts/{id}/posts/123456789_987654321/comments?limit=10" \
  -H "Authorization: Bearer $SOCAPI_KEY"
```

Sample response:

```json theme={null}
{
  "data": [
    {
      "id": "sapi_cmt_...",
      "platform": "facebook",
      "type": "comment",
      "author": {
        "id": "111222333",
        "name": "Jane Smith"
      },
      "content": {
        "text": "Great post!"
      },
      "metadata": {
        "post_id": "123456789_987654321",
        "hidden": false,
        "like_count": 2,
        "has_replies": true
      },
      "created_at": "2026-03-01T13:00:00Z",
      "account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
      "platform_id": "987654321_111222333"
    }
  ],
  "count": 1
}
```

### List DMs

```bash theme={null}
curl "https://api.social-api.ai/v1/accounts/{id}/dms?limit=10" \
  -H "Authorization: Bearer $SOCAPI_KEY"
```

## Publishing

Create a Facebook Page post with optional platform-specific fields:

```bash theme={null}
curl -X POST https://api.social-api.ai/v1/posts \
  -H "Authorization: Bearer $SOCAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Check out our new product!",
    "targets": [
      {
        "account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
        "platform_data": {
          "link": "https://example.com/product"
        }
      }
    ]
  }'
```

For the full field reference, media constraints, and error recovery, see [Facebook posts](/posts/facebook).

## Limitations and gotchas

* **Multi-Page OAuth**: a single OAuth flow connects all Facebook Pages the user manages. Each Page gets its own `account_id`.
* **Page tokens never expire**: unlike Instagram, Facebook Page tokens derived from long-lived user tokens do not expire. No reconnection needed unless the user revokes access.
* **Private replies**: replying to a comment with `"private": true` sends a one-time DM to the commenter. Can only be sent once per comment, within 7 days of the comment.
* **24-hour messaging window**: Pages can send any message within 24 hours of the user's last message. After that, only approved message tags are allowed. If you get an error sending a DM, the window may have closed.
* **Reviews deprecated**: Facebook deprecated Page Recommendations/Reviews in Graph API v22.0 (January 2025). The API returns `501` for review endpoints.

## Permissions

[SocialAPI](https://social-api.ai)'s managed Meta App already requests these scopes on your behalf: `pages_show_list`, `pages_read_engagement`, `pages_read_user_content`, `pages_manage_engagement`, `pages_manage_metadata`, `pages_messaging`, `pages_manage_posts`, `public_profile`, `business_management`. You don't need to apply for any platform app review. See [Platform credentials](/guides/platform-credentials).

## Related

* [Platform credentials](/guides/platform-credentials)
* [OAuth flows](/guides/oauth)
* [Publishing to Facebook](/posts/facebook)
* [Errors](/guides/errors)
* [Interaction IDs](/guides/interaction-ids)
