Page Management

Learn how to create pages, update pages, and manage Page content.

Endpoints & Webhooks

Refer to each endpoint's reference documentation for parameter and permission requirements.

Creating Pages

Requirements

  • User Access Token
  • Page Fields:
    • about
    • category_enum
    • cover_photo with url
    • name
    • picture
  • manage_pages permissions

Sample Request

On success, Graph API responds with JSON containing the Post ID:

{
  "id": "2011725632410952"
}

Learn more

See the Reference documentation for more information on creating pages, including caveats about adding a location.

Updating Pages

Update a Page with new information.

Requirements

  • Your Page ID
  • User Access Token
  • Admin of the Page
  • manage_pages permissions

Sample Request

On success, Graph API responds with JSON containing the Post ID:

{
  "success": true
}

Creating Page Posts

Requirements to post as a Page:

  • Your Page ID
  • Page Access Token
  • Admin of the Page
  • manage_pages and publish_pages permissions

Requirements to post as an Individual:

  • Your Page ID
  • User Access Token
  • Admin of the Page
  • publish_pages permissions

Sample Request to Post a Message

On success, Graph API responds with JSON containing the Post ID:

{
  "id": 1353269864728879_1661203157268880"
}

Sample Request to Post a Photo

On success, Graph API responds with JSON containing the Post ID:

{
  "id": 1353269864728879_1661203157268880"
}

Sample Request to Post a Link

On success, Graph API responds with JSON containing the Post ID:

{
  "id": "1353269864728879_1661203157268880"
}

Updating Page Posts

Requirements

  • The Post ID of the Post you want to update
  • Page Access Token
  • Admin of the Page
  • publish_pages permissions

Sample Request to Update a Post

On success, Graph API responds with JSON containing the Comment ID:

{
  "id": "1661203157268880_1661364040586125"
}

The following content is from the Webhooks product documentation. Please refer to the Webhooks documentation if you are unfamiliar with Webhooks.

Webhooks for Pages

Webhooks for Pages can send you real-time notifications of changes to your Pages. For example, you can receive real-time updates whenever users post to your feed, comment on a post, or like your posts.

To set up a Page Webhook:

  1. Set up your endpoint and configure the Webhooks product.
  2. Install your app using your Facebook page.

Setting Up Your Endpoint and Webhook Product

Follow our Getting Started guide to create your endpoint and configure the Webhooks product. During configuration, make sure to choose the Page object and subscribe to one or more of the Pages fields below.

As part of the v3.3 changes, the conversations webhook field was deprecated. Use messages fields to receive Page Messenger messages. The conversations field will stop working after December 31 2019.

As part of the v4.0 changes, the likes webhook field was deprecated. Use the reactions field to receive Page feed likes. The likes field will stop working for all versions after October 29 2019.

FieldDescription

feed

Notifies you when an Page's feed has changed; posts, reactions, shares, etc.

messages

Notifies you when your page has received a Messenger update. See Messenger webhook for all messages fields

Install Your App

Webhook notifications will only be sent if your Page has installed your Webhooks configured-app, and if the Page has not disabled the App platform in its App Settings. To get your Page to install the app, have your app send a POST request to the Page's subscribed_apps edge using the Page's acccess token.

Permissions

The Page's access token with the following permissions:

  • manage_pages
  • For the messages related fields only pages_messaging is required

For example, if your Page had the id 145634995501895, you could have your app send a request like this:

Sample Request

curl -i -X POST \
  -d "access_token=page-access-token" \
  "https://graph.facebook.com/v4.0/145634995501895/subscribed_apps?subscribed_fields=feed"
  

Sample Response

{
  "success": "true"
}

To see which app's your Page has installed, send a GET request instead:

Sample Request

GET graph.facebook.com/145634995501895/subscribed_apps

Sample Response

{
  "data": [
    {
      "category": "Business",
      "link": "https://my-clever-domain-name.com/app",
      "name": "My Sample App",
      "id": "145634995501895"
    }
  ]
}

If your Page has not installed any apps, the API will return an empty data set.

Graph API Explorer

If you don't want to install your app programmatically, you can easily do it with the Graph API Explorer instead:

  1. Select your app in the Application dropdown menu. This will return your app's access token.
  2. Click the Get Token dropdown and select Get User Access Token, then choose the manage_pages permission. This will exchange your app token for a User access token with the manage_pages permission granted.
  3. Click Get Token again and select your Page. This will exchange your User access token for a Page access token.
  4. Change the operation method by clicking the GET dropdown menu and selecting POST.
  5. Replace the default me?fields=id,name query with the Page's id followed by /subscribed_apps, then submit the query.

Common Uses

Getting Page Feed Details

Your app can subscribe to a Page's Feed and get notified anytime any Feed-related change occurs. For example, here's a notification sent when a User posted to the 1353269864728879 Page.

Sample Webhook Response

[
  {
    "entry": [
      {
        "changes": [
          {
            "field": "feed",
            "value": {
              "from": {
                "id": "156407155145863",
                "name": "Cinderella Hoover"
              },
              "item": "post",
              "post_id": "1353269864728879_1611108832278313",
              "verb": "add",
              "created_time": 1520544814,
              "is_hidden": false,
              "message": "It's Thursday and I want to eat cake."
            }
          }
        ],
        "id": "1353269864728879",
        "time": 1520544816
      }
    ],
    "object": "page"
  }
]

Use the post_id from the notification to comment on that Page post.

Sample API Request

curl -i -X POST \
  -d "message=I%20want%20chocolate%20cake%20!" \
  -d "access_token=page-access-token" \
  "https://graph.facebook.com/v2.11/1353269864728879_1611108832278313/comments"

Sample API Response

{
  "id": "1611108832278313_1611111875611342"
}