Publish Group Feed, Photos, and Videos
Learn how to publish posts, photos, and videos in a group.
We'll cover the following...
Publish feed
The base URL for this endpoint is:
https://graph.facebook.com/v16.0/{group_id}/feed
Request Parameters
Parameter | Type | Category | Description |
| String | Mandatory | This is the token that we received after app authentication and authorization. |
| String | Optional | These are the fields we want in the response from the API call. |
| String | Mandatory | This is the ID of the group. Note that this is a path parameter. |
| String | Optional | This is the text of the post. This parameter is required if we're publishing a plaintext post. |
| String | Optional | This is the URL that will be included in the post. If we include a link, the |
| String | Optional | This is the name of the link that will be included in the post. |
| String | Optional | This is the caption of the link that will be included in the post. |
| String | Optional | This is the description of the link that will be included in the post. |
| Array | Optional | This is a comma-separated list of user IDs of people tagged in the post. |
| String | Optional | This is the ID of a previously-uploaded photo or video to use as the primary content for the post. |
To publish a post on a Facebook group using the Graph API, we need to make a POST request to the /{group_id}/feed endpoint using a user access token with the publish_to_groups permission. The code below uses the endpoint above. Click the “Run” button to see the response.
In the code widget above:
Line 5: We define the endpoint URL in the
endpointUrlvariable.Lines 18–21: We add the
access_tokenand specify themessagein thequeryParametersvariable.Line 27: We use the
fetchfunction to make the API call.
Response Fields
Name | Type | Description |
| String | This is the ID of the post. |
| String | This is the time when the post was created. The time is in ISO 8601 format. |
| Object | This is the object containing the ID and name of the user or page that created the post. |
| Object | This is the object containing the ID and name of the group where the post was made. |
Note: In order to view the feed, we will make a
GETrequest to the same endpoint.
Publish photo
Photos on a Facebook group are a way for group members to share pictures and visual content with the group. Users can use them to share updates, memories, or other types of content. Photos can be a great way for group members to connect and engage with one another visually. Posting photos is also a great way to create and maintain a visual history of the group's activities and for businesses to showcase their products. The base URL for this endpoint is:
https://graph.facebook.com/v16.0/{group_id}/photos
Request Parameters
Parameter | Type | Category | Description |
| String | Mandatory | This is the token that we received after app authentication and authorization. |
| String | Mandatory | This is the group's ID. Note that this is a path parameter. |
| String | Optional | This is the binary file of the photo to be uploaded. |
| String | Optional | This is the caption of the photo. |
| Boolean | Optional | This indicates whether the photo should be published immediately or be saved as a draft. |
| String | Optional | This is the ID of the Facebook page of the location associated with this photo. |
To publish a new photo on the group using the Facebook Graph API, we can make a POST request to the photos edge of the group object using the group's ID and user access token with the publish_to_groups permission. Click the “Run” button to see the response.
In the code widget above:
Line 7: We define the endpoint URL in the
endpointUrlvariable.Line 14: We read the photo using the
readFileSyncfunction of thefslibrary.Lines 17–19: We add the
access_tokenin thequeryParametersvariable.Lines 21–23: We create a
FormDataand append thecaptionandphototo it.Line 36: We use the
fetchfunction to make the API call.
Response Fields
Name | Type | Description |
| String | This is the ID of the photo. |
| String | This is the time when the photo was created. The time is in ISO 8601 format. |
| Object | This is the object containing the ID and name of the user or page that uploaded the photo. |
Publish video
Videos on a Facebook group are a way for members to share video content with the group. Members can use videos to share updates, demonstrations, tutorials, or other types of content. Videos are an excellent way for group members to express themselves creatively and share experiences and information dynamically and engagingly. Businesses or organizations can use videos to demonstrate products and services or to showcase behind-the-scenes happenings. The base URL for this endpoint is:
https://graph.facebook.com/v16.0/{group_id}/videos
Request Parameters
Parameter | Type | Category | Description |
| String | Mandatory | This is the token that we received in response after making the call to the |
| String | Mandatory | This is the group's ID. Note that this is a path parameter. |
| String | Optional | This is the title of the video. |
| String | Optional | This is the description of the video. |
| String | Mandatory | This is the binary form of the video file we want to upload on the group. |
| String | Optional | This indicates whether the video should be published immediately or be saved as a draft. |
To publish a new video on the group using the Facebook Graph API, we can make a POST request to the videos edge of the group object using the group's ID and user access token that has the publish_to_groups permission. Click the “Run” button to see the response.
In the code widget above:
Line 7: We define the endpoint URL in the
endpointUrlvariable.Line 14: We read the video file using the
readFileSyncfunction of thefslibrary.Lines 17–19: We add the
access_tokenin thequeryParametersvariable.Lines 21–23: We create a
FormDataand append thedescriptionandvideo_fileto it.Line 36: We use the
fetchfunction to make the API call.
Response Fields
Name | Type | Description |
| String | This is the ID of the video. |
| String | This is the description of the video. |
| Object | This is the object containing the ID and name of the user or page that posted the video. |
| String | This is the title of the video. |
| String | This is the video file's URL. |
| String | This is the time when the video was created. The time is in ISO 8601 format. |
| String | This is the time when the video was updated. This time is in ISO 8601 format. |