# Facebook Group Search (`mo_khairy/facebook-group-search`) Actor

Find Facebook group links in bulk by keyword. Export group names, URLs, and matched keywords to CSV or JSON, or pass the URLs to Facebook Groups Scraper.

- **URL**: https://apify.com/mo_khairy/facebook-group-search.md
- **Developed by:** [Mohamed Khairy](https://apify.com/mo_khairy) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$8.00 / 1,000 group returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Facebook Group Search

Find Facebook groups by keyword and export group names, URLs, and matching keywords. Use the results to shortlist communities for research or collect their posts with [Facebook Groups Scraper](https://apify.com/mo_khairy/fb-multi-group-scraper).

### Find groups by keyword

```json
{
  "mode": "indexed_discovery",
  "keywords": ["tesla owners", "sourdough baking"],
  "maxGroupsPerKeyword": 4
}
```

Indexed discovery searches Google for Facebook group pages. It fetches the first search page for each keyword, then requests more pages where the result count falls short, up to the search page limit. Each group URL appears once, with all the keywords that matched it.

```json
{
  "name": "Sourdough Baking for Beginners",
  "url": "https://www.facebook.com/groups/1191938588453571/",
  "matchedKeywords": ["sourdough baking"],
  "source": "google_index"
}
```

Export the dataset as CSV or JSON from the Output tab. To collect posts, copy `scraperInput` from the `OUTPUT_SUMMARY` record in the run's key-value store and use it as input for Facebook Groups Scraper. Review the links first. Google can return stale listings, private groups, or loosely related matches.

### Live group details

Choose `page_details` for direct group URL lookups or when you need privacy and member-count filters. This mode opens Facebook pages and returns metadata when visible. Facebook may show a login wall to Apify cloud runs. Blocked pages are reported in `OUTPUT_SUMMARY`. Indexed discovery does not verify privacy, member counts, or activity.

### Search costs

Keyword searches call [Google Search Scraper](https://apify.com/apify/google-search-scraper), which bills per search results page. A low result cap can limit follow-up requests. Search charges can apply even when a query yields no group links.

# Actor input Schema

## `mode` (type: `string`):

Indexed discovery returns group names and URLs from Google. Page details attempts to read live Facebook metadata.

## `keywords` (type: `array`):

One search per keyword, for example "tesla owners" or "gardening london".

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

Known Facebook group links to look up directly, without searching.

## `maxGroupsPerKeyword` (type: `integer`):

Maximum number of group candidates per keyword.

## `publicOnly` (type: `boolean`):

Skip private groups.

## `minMembers` (type: `integer`):

Skip groups with fewer members than this.

## `maxMembers` (type: `integer`):

Skip groups with more members than this.

## `maxConcurrency` (type: `integer`):

How many pages to open at once.

## `proxy` (type: `object`):

Optional proxy configuration.

## Actor input object example

```json
{
  "mode": "indexed_discovery",
  "keywords": [
    "tesla owners"
  ],
  "maxGroupsPerKeyword": 4,
  "publicOnly": false,
  "maxConcurrency": 3
}
```

# Actor output Schema

## `groups` (type: `string`):

Group names, URLs, and other fields available in the selected search mode.

## `summary` (type: `string`):

Counts by keyword and, for indexed discovery, group URLs ready for Facebook Groups Scraper.

# 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 = {
    "mode": "indexed_discovery",
    "keywords": [
        "tesla owners"
    ],
    "maxGroupsPerKeyword": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("mo_khairy/facebook-group-search").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 = {
    "mode": "indexed_discovery",
    "keywords": ["tesla owners"],
    "maxGroupsPerKeyword": 4,
}

# Run the Actor and wait for it to finish
run = client.actor("mo_khairy/facebook-group-search").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "mode": "indexed_discovery",
  "keywords": [
    "tesla owners"
  ],
  "maxGroupsPerKeyword": 4
}' |
apify call mo_khairy/facebook-group-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mo_khairy/facebook-group-search"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/zZvvW7oeKcrWxCMUY/builds/pNxazWtCfdkg8U4JM/openapi.json
