Common Uses

These are common uses for the Groups API.

Posting On A Group

You can perform a POST operation with the /{group-id}/feed edge to post content on a Group on behalf of a group member who has granted your app permission to do so.

Sample Request

curl -i -X POST \
  -F "message=I%20love%20this%20group!" \
  -F "access_token=EAACEdEos0..." \
  "https://graph.facebook.com/554611227955614/feed"

Sample Response

{
 "id": "554611227955614_1708186035931455"
}

Getting Group Posts

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/554611227955614/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"
    },
    {
      "message": "I like how linked groups look on mobile!",
      "updated_time": "2018-06-14T23:19:02+0000",
      "id": "554611227955614_1687969857953073"
    }
  ]
}

Sample Response

Sample response with publicly available User fields included.

{
  "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"
    }
  ]
}

App Installation Webhooks

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"
  }
}

Getting 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/554611227955614/opted_in_members&access_token=EAACEdEos0..."

Sample Response

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