Guides

This guide describes common uses for the Groups API.

Get Posts for a Group

You can perform a GET operation on the /{group-id}/feed edge to get posts on a Group.

By default, personally identifiable information will not be included in the response. In order to have the post author's publicly available information included in the response, the post author must grant your app the groups_access_member_info permission.

Sample Request

curl -i -X GET \ 
  "https://graph.facebook.com/{group-id}/feed?limit=5&access_token=EAACEdEos0..."

Sample Response

Sample response with personally identifiable information omitted.

{
  "data": [
    {
      "message": "I love this group!",
      "updated_time": "2018-06-28T23:31:49+0000",
      "id": "554611227955614_1708186035931455"  //Post ID
    },
    {
      "message": "I like how linked groups look on mobile!",
      "updated_time": "2018-06-14T23:19:02+0000",
      "id": "554611227955614_1687969857953073"  //Post ID
    }
  ]
}

Sample Response

Sample response where the post author granted your app the groups_access_member_info permission.

{
  "data": [
    {
      "from": {
        "name": "Himanshu Sharma",
        "id": "512130107215"
      },
      "message": "I love this group!",
      "id": "554611227955614_1708186035931455"
    },
    {
      "from": {
        "name": "Ronak Patel",
        "id": "512130107214"
      },
      "message": "Just testing how linked groups look like on mobile!",
      "id": "554611227955614_1687969857953073"
    }
  ]
}

Limitations

  • Calls will only return data from posts created within the last 90 days.

Get Users Who Share Public Fields

You can perform a GET operation on the /{group-id}/opted_in_members edge to get a list of group member Users who have granted your app the groups_access_member_info permission. These are group members who have chosen to share their publicly available information with apps installed on the Group.

Sample Request

curl -i -X GET \ 
  "https://graph.facebook.com/{group-id}/opted_in_members&access_token=EAACEdEos0..."

Sample Response

{
  "data": [
    {
      "name": "Himanshu Sharma",
      "id": "510765591715"
    },
    {
      "name": "Ronak Patel",
      "id": "410662391314"
    }
  ]
}

Get Webhooks for Groups Who Install/Uninstall Your App

You can subscribe to the group_install field on the Application object to receive a webhook notification whenever a group member installs or uninstalls your app on a Group.

Sample Notification

{
  "field": "group_install",
  "value": {
    "group_id": "954704787945183",
    "update_time": "1527459824",
    "verb": "add",
    "actor_id": "499619301"
  }
}