Bootstrap FreeKB - Facebook Graph API - Get Group Feed using Graph API
Facebook Graph API - Get Group Feed using Graph API

Updated:   |  Facebook Graph API articles

This assumes you are already created an app in https://developers.facebook.com. If not, check out my article Getting Started with Facebook Graph API.

You will first need to get the User Access Token. Check out my article Facebook Graph API - Get Access Token. For example, 

  1. Go to https://developers.facebook.com and select My Apps.
  2. Select your App.
  3. Select Tools > Graph API Explorer.

By default, the query should be setup to GET v18.0/me?fields=id,name. Select Submit and this should return your User ID and User Access Token, something like this.

EAANROE66DrsBOy1TiJVQPEPEZAgo2Iap7QzdKEGRfJBW30drpIpkprZB4N5MRxDfZCoLh4OQZCCDgPqVxFEO39YDTIZCmChr9b3QcDr5MxPSjxvnY4Q1uPpMZCgG6Tr0FsZAW2vJD3qo5LpYZCu2JE2VhBUZCAPnZCCnysHlvca9QQ9BS2cvXxccHmUGPEKml4ncE0BYrfh7bI9ZAL9M7sLBgZDZD

 

Then submit a GET request to the /<group id> endpoint and something like this should be returned.

{
  "name": "my Group",
  "privacy": "OPEN",
  "id": "123456789012345"
}

 

Or like this, using curl.

curl \
--request GET \
--url "https://graph.facebook.com/v18.0/<group id>?access_token=<user access token>"

 

And then you can submit a request to the /<group id>/feed endpoint to list the groups feed.

curl \
--request GET \
--url "https://graph.facebook.com/v18.0/<group id>/feed?limit=2&access_token=<user access token>"

 

Something like this should be returned.

{
  "data": [
    {
      "updated_time": "2023-11-02T00:15:31+0000",
      "message": "Hello",
      "id": "123456789012345_1234567890123456"
    },
    {
      "updated_time": "2023-10-23T02:59:17+0000",
      "message": "World",
      "id": "123456789012345_1234567890123456"
    }
  ],
  "paging": {
    "previous": "https://graph.facebook.com/v18.0/123456789012345/feed?access_token=EAANR.....5QZDZD",
    "next": "https://graph.facebook.com/v18.0/123456789012345/feed?access_token=EAANR.....AZDZD&__previous"
  }
}

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 50a439 in the box below so that we can be sure you are a human.