View Group Events

Learn how to get a group's events.

We'll cover the following
Group events
Group events

Facebook allows group members to create and promote events within the group. These events can be public or private and include information such as the event name, location, date, and time, as well as a description and photos. Group events are an excellent way for members to coordinate and organize events, whether they be social gatherings, meetings, or volunteer opportunities. Businesses and organizations can also use group events to promote and coordinate their events, such as product launches, workshops, webinars, or any open-door event.

The base URL for this endpoint is:

https://graph.facebook.com/v16.0/{group_id}/events

Request parameters

The following are the request parameters for the above endpoint.

Parameter

Type

Category

Description

access_token

String

Mandatory

This is the token that we received after app authentication and authorization.

group_id

String

Mandatory

This is the ID of the group. Note that this is a path parameter.

fields

String

Optional

These are the fields we want in the response from the API call.

limit

String

Optional

This specifies the maximum number of results we want in the response. The default is 25, and the maximum is 100.

since

String

Optional

This is the Unix timestamp or strtotime data, specifying the starting point of the range of time-based data, retrieving all events created after this date.

until

String

Optional

This is the Unix timestamp or strtotime data, specifying the ending point of the range of time-based data, retrieving all events created before this date.

To view group events on a Facebook group using the Graph API, we need to make a GET request to the events edge of the group object using a user access token. The code below uses the endpoint above. Click the “Run” button to see the response.

Press + to interact
// Importing libraries here
import fetch from "node-fetch"
// Define endpoint URL here
const endpointUrl = new URL("https://graph.facebook.com/v16.0/{{GROUP_ID}}/events");
const headerParameters = {
contentType: "application/json",
};
// Setting API call options
const options = {
method: "GET",
headers: headerParameters,
};
// Define Query Parameters here
const queryParameters = new URLSearchParams({
access_token: '{{USER_ACCESS_TOKEN}}',
});
// Function to make API call
async function viewGroupEvents() {
try {
endpointUrl.search = queryParameters;
const response = await fetch(endpointUrl, options);
// Printing response
printResponse(response);
} catch (error) {
// Printing error message
printError(error);
}
}
// Calling function to make API call
viewGroupEvents();

In the code widget above:

  • Line 5: We define the endpoint URL in the endpointUrl variable.

  • Lines 18–20: We add the access_token in the queryParameters variable.

  • Line 26: We use the fetch function to make the API call.

Response fields

The response fields for the above endpoint are given below.

Name

Type

Description

id

String

This is the ID of the event.

name

String

This is the name of the event.

description

String

This is the description of the event.

start_time

DateTime

This is the start time of the event. The time is in ISO 8601 format.

end_time

DateTime

This is the end time of the event. The time is in ISO 8601 format.

timezone

String

This is the timezone for the event.

place

Object

This is the object containing the location information for the event.

rsvp_status

String

This is the RSVP status of the user who made the request.

updated_time

DateTime

This is the time when the event was last updated. The time is in ISO 8601 format.

paging

Object

This is the information about the pagination of the feed. It contains fields such as next and previous, which we can use to retrieve the next and previous pages of the feed, respectively.

summary

Object

This is a summary of the feed containing information such as total_count (number of total posts in the feed) and can_like (indicating whether or not the feed can be liked).

Note: Group docs on Facebook allow members to easily upload and share documents, presentations, spreadsheets, and other files. To access group docs, change /events with /docs on line 5 in the code widget above. Note that this endpoint will only work if your app has gone through the "App Review" stage and is verified by Facebook.