# Facebook Groups Scraper (`khadinakbar/facebook-groups-scraper`) Actor

Scrape public Facebook group posts by group URL or group ID. Export post text, author, engagement counts, media URLs, top comments, and pagination cursors.

- **URL**: https://apify.com/khadinakbar/facebook-groups-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, Lead generation, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 facebook group post scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Facebook Groups Scraper

Scrape public Facebook group posts by group URL or group ID. The actor returns clean, MCP-friendly dataset records with post text, author details, publish time, engagement counts, media URLs, top-comment previews, provider source, and run telemetry.

### What it extracts

- Group URL, group ID, and group slug
- Post ID and direct post URL
- Post text
- Author name, ID, and profile URL when available
- Published timestamp
- Reaction, comment, share, video-view, and engagement counts
- Image, thumbnail, and video URLs when available
- Top-comment previews when returned by the data source
- Cursor information in `RUN_SUMMARY.nextCursors` for resumable provider pagination

### Data sources

This actor is designed for public Facebook group data.

1. ScrapeCreators provider API, using the actor owner's `SCRAPECREATORS_API_KEY` secret.
2. SociaVault provider API, using `SOCIAVAULT_API_KEY` or `SOCIALVAULT_API_KEY`.
3. Playwright browser fallback for public pages, optionally with a user-provided authorized Facebook cookie session.

Provider APIs currently return up to 3 posts per request and paginate with a cursor. Increase `maxPagesPerGroup` to collect more posts, and use `RUN_SUMMARY.nextCursors` to resume later.

### Input

- `groupUrls`: Facebook group URLs such as `https://www.facebook.com/groups/homemakingtips/`.
- `groupIds`: Optional numeric group IDs.
- `maxPosts`: Maximum saved posts across all groups.
- `maxPagesPerGroup`: Provider pages per group.
- `sortBy`: `RECENT_ACTIVITY`, `TOP_POSTS`, `CHRONOLOGICAL`, or `CHRONOLOGICAL_LISTINGS`.
- `dataSource`: `auto`, `provider`, or `browser`.
- `facebookCookies`: Optional JSON cookie array or raw Cookie header for browser fallback only.
- `includeRawData`: Adds the raw source object to each row.

### Output

Each dataset item is one Facebook group post. Run summaries are written to the default key-value store:

- `RUN_SUMMARY`: Full telemetry with counts, provider status codes, cursors, and stop reason.
- `OUTPUT`: Compact agent-friendly summary.

### Limits and compliance

Closed, private, deleted, age-gated, or membership-only content may return no records. Use cookies only for Facebook accounts and group content you are authorized to access. The actor soft-fails with a summary instead of crashing when a group is unavailable or no public posts are found.

### Pricing

Pay-per-event is configured at `$0.004` per saved post plus a tiny actor-start event.

# Actor input Schema

## `groupUrls` (type: `array`):

One or more public Facebook group URLs, for example https://www.facebook.com/groups/homemakingtips/.
## `groupIds` (type: `array`):

Optional numeric Facebook group IDs. Use this when you know the group ID and do not have a URL.
## `maxPosts` (type: `integer`):

Maximum number of group post records to save across all groups.
## `maxPagesPerGroup` (type: `integer`):

Provider APIs currently return up to 3 posts per request and paginate with a cursor.
## `startCursor` (type: `string`):

Optional provider pagination cursor. Use a cursor from RUN_SUMMARY.nextCursors to resume a group feed.
## `sortBy` (type: `string`):

Provider-side Facebook group post ordering.
## `dataSource` (type: `string`):

Auto tries configured providers first, then browser fallback when enabled. Provider only skips browser fallback. Browser only skips provider APIs.
## `providerOrder` (type: `string`):

Choose which managed provider API is tried first.
## `useBrowserFallback` (type: `boolean`):

Try a Playwright browser scrape when provider APIs are unavailable, empty, or disabled.
## `maxBrowserScrolls` (type: `integer`):

Maximum page scrolls in browser fallback mode.
## `facebookCookies` (type: `string`):

Optional JSON cookie array or raw Cookie header for browser fallback only. Use your own authorized session; do not use this for data you are not allowed to access.
## `proxy` (type: `object`):

Proxy settings for browser fallback.
## `includeRawData` (type: `boolean`):

Include raw source objects in each dataset row for debugging and custom downstream parsing.

## Actor input object example

```json
{
  "groupUrls": [
    "https://www.facebook.com/groups/homemakingtips/"
  ],
  "maxPosts": 100,
  "maxPagesPerGroup": 5,
  "sortBy": "RECENT_ACTIVITY",
  "dataSource": "auto",
  "providerOrder": "scrapecreators-first",
  "useBrowserFallback": true,
  "maxBrowserScrolls": 8,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "includeRawData": false
}
````

# Actor output Schema

## `posts` (type: `string`):

Structured dataset records for scraped public Facebook group posts.

## `postsCsv` (type: `string`):

CSV export of the same Facebook group post records.

## `runSummary` (type: `string`):

Machine-readable telemetry with post counts, groups processed, providers used, provider status codes, cursors, and stop reason.

## `outputSummary` (type: `string`):

Compact agent-friendly summary with posts scraped, groups processed, groups with results, providers used, and stop reason.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "groupUrls": [
        "https://www.facebook.com/groups/homemakingtips/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/facebook-groups-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "groupUrls": ["https://www.facebook.com/groups/homemakingtips/"] }

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/facebook-groups-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "groupUrls": [
    "https://www.facebook.com/groups/homemakingtips/"
  ]
}' |
apify call khadinakbar/facebook-groups-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=khadinakbar/facebook-groups-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Groups Scraper",
        "description": "Scrape public Facebook group posts by group URL or group ID. Export post text, author, engagement counts, media URLs, top comments, and pagination cursors.",
        "version": "0.1",
        "x-build-id": "lVerxqvnVVgkr4ttU"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/khadinakbar~facebook-groups-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-khadinakbar-facebook-groups-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/khadinakbar~facebook-groups-scraper/runs": {
            "post": {
                "operationId": "runs-sync-khadinakbar-facebook-groups-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/khadinakbar~facebook-groups-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-khadinakbar-facebook-groups-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "groupUrls": {
                        "title": "Facebook group URLs",
                        "type": "array",
                        "description": "One or more public Facebook group URLs, for example https://www.facebook.com/groups/homemakingtips/.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "groupIds": {
                        "title": "Facebook group IDs",
                        "type": "array",
                        "description": "Optional numeric Facebook group IDs. Use this when you know the group ID and do not have a URL.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPosts": {
                        "title": "Maximum posts",
                        "minimum": 1,
                        "maximum": 3000,
                        "type": "integer",
                        "description": "Maximum number of group post records to save across all groups.",
                        "default": 100
                    },
                    "maxPagesPerGroup": {
                        "title": "Max provider pages per group",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Provider APIs currently return up to 3 posts per request and paginate with a cursor.",
                        "default": 5
                    },
                    "startCursor": {
                        "title": "Start cursor",
                        "type": "string",
                        "description": "Optional provider pagination cursor. Use a cursor from RUN_SUMMARY.nextCursors to resume a group feed."
                    },
                    "sortBy": {
                        "title": "Sort by",
                        "enum": [
                            "RECENT_ACTIVITY",
                            "TOP_POSTS",
                            "CHRONOLOGICAL",
                            "CHRONOLOGICAL_LISTINGS"
                        ],
                        "type": "string",
                        "description": "Provider-side Facebook group post ordering.",
                        "default": "RECENT_ACTIVITY"
                    },
                    "dataSource": {
                        "title": "Data source",
                        "enum": [
                            "auto",
                            "provider",
                            "browser"
                        ],
                        "type": "string",
                        "description": "Auto tries configured providers first, then browser fallback when enabled. Provider only skips browser fallback. Browser only skips provider APIs.",
                        "default": "auto"
                    },
                    "providerOrder": {
                        "title": "Provider order",
                        "enum": [
                            "scrapecreators-first",
                            "sociavault-first",
                            "scrapecreators-only",
                            "sociavault-only"
                        ],
                        "type": "string",
                        "description": "Choose which managed provider API is tried first.",
                        "default": "scrapecreators-first"
                    },
                    "useBrowserFallback": {
                        "title": "Use browser fallback",
                        "type": "boolean",
                        "description": "Try a Playwright browser scrape when provider APIs are unavailable, empty, or disabled.",
                        "default": true
                    },
                    "maxBrowserScrolls": {
                        "title": "Max browser scrolls",
                        "minimum": 0,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Maximum page scrolls in browser fallback mode.",
                        "default": 8
                    },
                    "facebookCookies": {
                        "title": "Facebook cookies",
                        "type": "string",
                        "description": "Optional JSON cookie array or raw Cookie header for browser fallback only. Use your own authorized session; do not use this for data you are not allowed to access."
                    },
                    "proxy": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy settings for browser fallback.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    },
                    "includeRawData": {
                        "title": "Include raw provider data",
                        "type": "boolean",
                        "description": "Include raw source objects in each dataset row for debugging and custom downstream parsing.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
