# Facebook Group Scraper (Posts and Details ) (`scrapeengine/facebook-group-posts-and-details-scraper-pay-per-events`) Actor

- **URL**: https://apify.com/scrapeengine/facebook-group-posts-and-details-scraper-pay-per-events.md
- **Developed by:** [ScrapeEngine](https://apify.com/scrapeengine) (community)
- **Categories:** Automation, Lead generation, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.99 / 1,000 results

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 Group Posts & Details Scraper

Apify Actor that scrapes **public (and optionally logged-in) Facebook group feeds** via Facebook’s internal GraphQL endpoints. It outputs **post text, post id, author fields, avatar URL, timestamp, and group URL** — aligned with the [dataset schema in `.actor/actor.json`](./.actor/actor.json).

#### What it actually extracts

| Field | Notes |
| --- | --- |
| Post text, post id | From the group feed query |
| Author name, id, profile URL, avatar | When present in the feed payload |
| Timestamp | Regex-extracted from feed JSON nodes (`extract_epoch_from_node`) |
| Group URL | Added per row |

**Not included in this Actor:** comment threads, reaction counts, media URL lists, or member lists. Those would require separate GraphQL operations and are not implemented in the current code. Marketing copy that claims otherwise should be ignored in favor of this README and the actor schema.

#### Reliability

Facebook may return **empty feed pages**, **missing `doc_id` in JS bundles**, or **GraphQL errors** when requests look automated. The actor uses **`src/helper.py`** + **`src/group.py`** (same pipeline as standalone `helper.py` + `group.py`) and **`src/main.py`** (Apify input, residential proxy, KV monitoring, `push_data`). Residential **Apify proxy** is recommended. **cannot guarantee** full `maxPosts` on every run.

- **`maxPosts`** — **Global** maximum across all groups (minimum 10). With multiple groups, quotas are **split** like standalone `group.py` (`split_quota`); merged output is capped at `maxPosts`.
- **`monitoringMode`:** When enabled, only post IDs **not** already stored per group in the key-value store are **pushed**. For a **full re-scrape**, turn monitoring off.
- **Progress logs** refer to **collected posts vs `maxPosts`**, not a statistical “success rate.”

#### Input (summary)

- **`startUrls`** — Group URLs or group identifiers (required)
- **`maxPosts`** — Minimum 10; **total** cap across all groups when multiple URLs are listed
- **`sortOrder`**, **`startDate`**, **`proxyConfiguration`**
- **`monitoringMode`** — Incremental runs (KV-backed seen IDs)

#### Example input

```json
{
  "startUrls": [{ "url": "https://www.facebook.com/groups/your-group" }],
  "sortOrder": "RECENT_ACTIVITY",
  "maxPosts": 50,
  "monitoringMode": false
}
````

#### Example output row

```json
{
  "id": "25346255468358122",
  "image": "https://scontent...",
  "postText": "Post content...",
  "postAuthor": "Jane Doe",
  "postAuthorId": "100048765312428",
  "postAuthorUrl": "https://www.facebook.com/...",
  "email": "",
  "firstName": "Jane",
  "lastName": "Doe",
  "timestamp": "1711800000",
  "groupUrl": "https://www.facebook.com/groups/example"
}
```

#### Legal / ethical use

Only scrape content you have the right to access. Respect Facebook’s Terms of Service and applicable laws. Use responsible rate limits and data handling.

# Actor input Schema

## `startUrls` (type: `array`):

📋 Enter one or more Facebook group URLs or group identifiers.

💡 Examples:
• Full URL: https://www.facebook.com/groups/germtheory.vs.terraintheory
• Group ID: germtheory.vs.terraintheory

✨ You can add multiple groups to scrape them all in one run!

## `monitoringMode` (type: `boolean`):

🔔 **Track only fresh content**.

When enabled, the Actor remembers which post IDs it has already seen and **skips duplicates in future runs**.
Perfect for monitoring active groups every day without re‑processing old posts.

🗂️ Uses Apify Key‑Value Store under the hood to persist seen post IDs.

## `maxPosts` (type: `integer`):

🎯 **Global cap** across the whole run (same as standalone `group.py`).

With **multiple** `startUrls`, the cap is **split** across groups (`split_quota`) and results are merged, then capped at this value.
With **one** group, that group gets the full quota.

📌 Minimum: **10**.
💡 Example: `maxPosts: 50` with 2 groups → ~25 posts per group, **≤50** total in the dataset.

## `sortOrder` (type: `string`):

Sorting strategy for the group feed (`sortingSetting` in GraphQL variables).

## `startDate` (type: `string`):

🗓️ Only scrape posts newer than the selected date.

📝 Format: YYYY-MM-DD (e.g., 2025-02-20)

💡 Leave empty to scrape all available posts regardless of date
✨ Useful for getting only recent content or posts from a specific time period

## `proxyConfiguration` (type: `object`):

Proxy settings (optional). This actor always uses residential proxy regardless of your choice. Configure Apify Proxy credentials if needed.

## Actor input object example

```json
{
  "startUrls": [
    "germtheory.vs.terraintheory",
    "https://www.facebook.com/groups/germtheory.vs.terraintheory"
  ],
  "monitoringMode": false,
  "maxPosts": 10,
  "sortOrder": "RECENT_ACTIVITY",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "startUrls": [
        "https://www.facebook.com/groups/cheapmealideas/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeengine/facebook-group-posts-and-details-scraper-pay-per-events").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 = {
    "startUrls": ["https://www.facebook.com/groups/cheapmealideas/"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapeengine/facebook-group-posts-and-details-scraper-pay-per-events").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 '{
  "startUrls": [
    "https://www.facebook.com/groups/cheapmealideas/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call scrapeengine/facebook-group-posts-and-details-scraper-pay-per-events --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapeengine/facebook-group-posts-and-details-scraper-pay-per-events",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Group Scraper (Posts and Details )",
        "version": "0.1",
        "x-build-id": "4gkMQIkavkW9ls5fK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapeengine~facebook-group-posts-and-details-scraper-pay-per-events/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapeengine-facebook-group-posts-and-details-scraper-pay-per-events",
                "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/scrapeengine~facebook-group-posts-and-details-scraper-pay-per-events/runs": {
            "post": {
                "operationId": "runs-sync-scrapeengine-facebook-group-posts-and-details-scraper-pay-per-events",
                "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/scrapeengine~facebook-group-posts-and-details-scraper-pay-per-events/run-sync": {
            "post": {
                "operationId": "run-sync-scrapeengine-facebook-group-posts-and-details-scraper-pay-per-events",
                "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",
                "required": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "🔗 Facebook Group URLs or Identifiers",
                        "type": "array",
                        "description": "📋 Enter one or more Facebook group URLs or group identifiers.\n\n💡 Examples:\n• Full URL: https://www.facebook.com/groups/germtheory.vs.terraintheory\n• Group ID: germtheory.vs.terraintheory\n\n✨ You can add multiple groups to scrape them all in one run!",
                        "items": {
                            "type": "string"
                        }
                    },
                    "monitoringMode": {
                        "title": "👁️ Monitoring Mode (only new posts)",
                        "type": "boolean",
                        "description": "🔔 **Track only fresh content**.\n\nWhen enabled, the Actor remembers which post IDs it has already seen and **skips duplicates in future runs**.\nPerfect for monitoring active groups every day without re‑processing old posts.\n\n🗂️ Uses Apify Key‑Value Store under the hood to persist seen post IDs.",
                        "default": false
                    },
                    "maxPosts": {
                        "title": "📊 Maximum Posts (total across all groups)",
                        "minimum": 10,
                        "type": "integer",
                        "description": "🎯 **Global cap** across the whole run (same as standalone `group.py`).\n\nWith **multiple** `startUrls`, the cap is **split** across groups (`split_quota`) and results are merged, then capped at this value.\nWith **one** group, that group gets the full quota.\n\n📌 Minimum: **10**.\n💡 Example: `maxPosts: 50` with 2 groups → ~25 posts per group, **≤50** total in the dataset.",
                        "default": 10
                    },
                    "sortOrder": {
                        "title": "🔄 Sort Order",
                        "enum": [
                            "RECENT_POSTS",
                            "TOP_POSTS",
                            "RECENT_ACTIVITY",
                            "CHRONOLOGICAL"
                        ],
                        "type": "string",
                        "description": "Sorting strategy for the group feed (`sortingSetting` in GraphQL variables).",
                        "default": "RECENT_ACTIVITY"
                    },
                    "startDate": {
                        "title": "📅 Filter Posts by Date",
                        "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
                        "type": "string",
                        "description": "🗓️ Only scrape posts newer than the selected date.\n\n📝 Format: YYYY-MM-DD (e.g., 2025-02-20)\n\n💡 Leave empty to scrape all available posts regardless of date\n✨ Useful for getting only recent content or posts from a specific time period"
                    },
                    "proxyConfiguration": {
                        "title": "🛡️ Proxy",
                        "type": "object",
                        "description": "Proxy settings (optional). This actor always uses residential proxy regardless of your choice. Configure Apify Proxy credentials if needed."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
