View Group Events
Learn how to get a group's events.
We'll cover the following...
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 |
| String | Mandatory | This is the token that we received after app authentication and authorization. |
| String | Mandatory | This is the ID of the group. Note that this is a path parameter. |
| String | Optional | These are the fields we want in the response from the API call. |
| String | Optional | This specifies the maximum number of results we want in the response. The default is 25, and the maximum is 100. |
| String | Optional | This is the Unix timestamp or |
| String | Optional | This is the Unix timestamp or |
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.
// Importing libraries hereimport fetch from "node-fetch"// Define endpoint URL hereconst endpointUrl = new URL("https://graph.facebook.com/v16.0/{{GROUP_ID}}/events");const headerParameters = {contentType: "application/json",};// Setting API call optionsconst options = {method: "GET",headers: headerParameters,};// Define Query Parameters hereconst queryParameters = new URLSearchParams({access_token: '{{USER_ACCESS_TOKEN}}',});// Function to make API callasync function viewGroupEvents() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl, options);// Printing responseprintResponse(response);} catch (error) {// Printing error messageprintError(error);}}// Calling function to make API callviewGroupEvents();
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 thequeryParameters
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 |
| String | This is the ID of the event. |
| String | This is the name of the event. |
| String | This is the description of the event. |
| DateTime | This is the start time of the event. The time is in ISO 8601 format. |
| DateTime | This is the end time of the event. The time is in ISO 8601 format. |
| String | This is the timezone for the event. |
| Object | This is the object containing the location information for the event. |
| String | This is the RSVP status of the user who made the request. |
| DateTime | This is the time when the event was last updated. The time is in ISO 8601 format. |
| Object | This is the information about the pagination of the feed. It contains fields such as |
| Object | This is a summary of the feed containing information such as |
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.