# Reddit Buying Intent Finder (`prodbysky/reddit-buying-intent-finder`) Actor

Find Reddit posts where users are actively asking for product/service recommendations in your niche. Give it a list of subreddits + intent keywords, get back warm leads with post URLs, scores, snippets, and match reason — perfect for service businesses, agencies, and SaaS.

- **URL**: https://apify.com/prodbysky/reddit-buying-intent-finder.md
- **Developed by:** [sky](https://apify.com/prodbysky) (community)
- **Categories:** SEO tools, AI, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

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/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

## Reddit Buying Intent Finder

> **Apify Actor** — given a list of subreddits and (optionally) intent keywords, extract Reddit posts where users are actively asking for product/service recommendations. For service businesses, agencies, and SaaS doing Reddit-based lead generation.

### What it does

1. **Subreddit scan** — fetches the recent feed of each subreddit you provide (e.g. `r/freelance`, `r/smallbusiness`, `r/webdev`) via Reddit's public `old.reddit.com/r/<sub>/search.json` endpoint. No OAuth required.
2. **Intent filter** — runs every post through a built-in buying-intent detector that matches phrases like:
   - "looking for" / "searching for"
   - "recommend me a…" / "anyone recommend…"
   - "best X for Y" / "best Y to use"
   - "anyone use / know / tried…"
   - "what do you use" / "what should I use"
   - "I need a…" / "need recommendations"
   - "alternative to…" / "switching from/to"
   - "X vs Y"
   You can also supply your own intent keywords; matching is case-insensitive substring across title (and optionally the post body).
3. **Output** — emits a single Apify dataset record containing:
   - The matching posts (deduplicated, sorted newest-first, capped to `maxPosts`),
   - Per-subreddit match counts,
   - The original input echoed back for reference.

Each emitted post includes `subreddit`, `postId`, `title`, `url`, `snippet`, `score`, `numComments`, `author`, `createdUtc`, `isSelf`, `flair`, and `intentMatches` (which patterns fired).

### Why

Many Apify Reddit scrapers exist but they are all "give me all posts in subreddit X." This one is *opinionated*: it returns only posts where a real person is shopping for what you sell. That's what you want when running a weekly lead-generation check before responding on Reddit.

### Input

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `subreddits` | array of strings | **yes** | — | Subreddits to search, WITHOUT the `r/` prefix. Example: `["fitness","webdev","smallbusiness"]`. 1–10 recommended. |
| `intentKeywords` | array of strings | no | `[]` | Optional extra intent patterns matched as case-insensitive substrings in title (and body, if `matchBody=true`). Example: `["crm","invoicing tool"]`. |
| `timeframe` | string enum | no | `month` | One of `hour`, `day`, `week`, `month`, `year`, `all`. Mapped to Reddit's `t=` parameter. |
| `maxPosts` | int 1–500 | no | 50 | Cap on matching posts in the output. |
| `maxPostsPerSub` | int 1–100 | no | 100 | Posts scanned per subreddit (the intent filter runs on this pool). Reddit caps at 100/page; we hard-cap at 5 pages. |
| `matchBody` | bool | no | `false` | If true, intent patterns and `intentKeywords` are also matched against the post's `selftext`. Off by default to reduce false positives from off-topic bodies. |
| `minScore` | int ≥ 0 | no | 0 | If set, only posts with at least this many upvotes are returned. |

### Output shape

```json
{
  "generatedAt": "2026-07-05T18:40:00.000Z",
  "inputSubreddits": ["freelance", "smallbusiness"],
  "timeframe": "month",
  "subSummaries": [
    { "subreddit": "freelance", "matchedCount": 7 },
    { "subreddit": "smallbusiness", "matchedCount": 3 }
  ],
  "totalMatched": 10,
  "returnedCount": 10,
  "posts": [
    {
      "subreddit": "freelance",
      "postId": "abc123",
      "title": "Looking for a good invoicing tool for solo freelancers?",
      "url": "https://www.reddit.com/r/freelance/comments/abc123/looking_for/",
      "snippet": "I've tried Wave but it doesn't do X...",
      "score": 14,
      "numComments": 6,
      "author": "alice",
      "createdUtc": 1751300000,
      "isSelf": true,
      "flair": "Question",
      "intentMatches": ["looking for", "custom:invoicing tool"]
    }
  ]
}
````

### Limits and known constraints

- **No login.** We use Reddit's public JSON endpoint, which returns 200 anonymously. If Reddit rate-limits or returns HTML, posts on that page are skipped (the actor keeps going on the next page / subreddit).
- **5 pages per subreddit max.** Hard-coded internal ceiling so a single request that hits a rate-limit doesn't loop forever. Tunable in `fetchSubredditPosts` if you want more depth.
- **Public posts only.** Posts in private/quarantined subreddits, or posts removed before our crawl, are not returned.
- **No comment threads.** This actor returns posts only, not the replies. Useful as a lead list; you'd open the URL to see what people are saying.

### Pricing model

Suggested on the Apify Store: **PAY\_PER\_EVENT ~$0.002 / matching post** (i.e. `$0.002 × matchedCount`). One actor run can return up to `maxPosts` results.

### Local development

```bash
## 1. Install
npm install

## 2. Structural tests only (no network, fast)
npm test

## 3. Full test suite + live Reddit fetch
npm run test:live

## 4. Smoke test: fetch real data against one subreddit
node check_trends.js

## 5. End-to-end run locally with the bundled test input
##    On Windows PowerShell:
$env:APIFY_LOCAL_INPUT_PATH='.\test_input.json'; node src/main.js
##    On macOS/Linux:
APIFY_LOCAL_INPUT_PATH=./test_input.json node src/main.js
```

Local mode writes results to `./output.json`. In Apify, results are pushed to the default dataset.

### File map

```
reddit-buying-intent-finder/
├── .actor/
│   ├── actor.json            # Apify actor manifest
│   └── input_schema.json     # Apify input UI schema
├── src/
│   └── main.js               # all logic (pure functions + run() + CLI entry)
├── test_input.json           # sample input for local runs
├── test_local.js             # structural + live integration tests
├── check_trends.js           # quick smoke-check (live, one subreddit)
├── package.json
├── Dockerfile                # apify/actor-node:18
├── .gitignore
└── README.md
```

### Test coverage

- **39 structural tests** (no network): URL builder, intent patterns (positive + negative cases for each built-in pattern), `matchBody` toggle, `minScore` filter, input validation (subreddit normalisation, timeframe enum, ranges), `extraKeywords` substring matching, snippet truncation, de-dup contract via `shapePost`.
- **2 live integration tests** (network):
  - Real fetch against `r/announcements`, verifying the parser normalises whatever Reddit returns today.
  - Direct JSON fetch against `r/fitness/search.json` to confirm the endpoint is reachable.

Run `npm run test:live` to exercise both.

# Actor input Schema

## `subreddits` (type: `array`):

One or more subreddit names WITHOUT the r/ prefix, e.g. \['fitness', 'webdev', 'smallbusiness']. 1-10 recommended.

## `intentKeywords` (type: `array`):

Optional list of intent patterns beyond the built-in set. These are matched as substring/word-fragments inside post titles and bodies. Examples: \['crm for', 'project management tool', 'invoicing app'].

## `timeframe` (type: `string`):

How far back to search. One of: 'hour', 'day', 'week', 'month', 'year', 'all'. Default 'month'.

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

Cap on posts returned. Higher = more results, slower run. Default 50.

## `maxPostsPerSub` (type: `integer`):

How many posts to fetch per subreddit before intent-filtering. Default 100. Reddit caps at 100 per page; pagination is internal.

## `matchBody` (type: `boolean`):

If true, intent matching also scans the post's selftext in addition to the title. Off by default to reduce noise.

## `minScore` (type: `integer`):

If set, only posts with at least this many upvotes are kept. Useful to filter out low-effort/troll posts. Default 0 (no filter).

## Actor input object example

```json
{
  "intentKeywords": [],
  "timeframe": "month",
  "maxPosts": 50,
  "maxPostsPerSub": 100,
  "matchBody": false,
  "minScore": 0
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("prodbysky/reddit-buying-intent-finder").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("prodbysky/reddit-buying-intent-finder").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 '{}' |
apify call prodbysky/reddit-buying-intent-finder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=prodbysky/reddit-buying-intent-finder",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Buying Intent Finder",
        "description": "Find Reddit posts where users are actively asking for product/service recommendations in your niche. Give it a list of subreddits + intent keywords, get back warm leads with post URLs, scores, snippets, and match reason — perfect for service businesses, agencies, and SaaS.",
        "version": "0.1",
        "x-build-id": "fFdORjJhOMtpnXj4d"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/prodbysky~reddit-buying-intent-finder/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-prodbysky-reddit-buying-intent-finder",
                "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/prodbysky~reddit-buying-intent-finder/runs": {
            "post": {
                "operationId": "runs-sync-prodbysky-reddit-buying-intent-finder",
                "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/prodbysky~reddit-buying-intent-finder/run-sync": {
            "post": {
                "operationId": "run-sync-prodbysky-reddit-buying-intent-finder",
                "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": [
                    "subreddits"
                ],
                "properties": {
                    "subreddits": {
                        "title": "Subreddits to search",
                        "minItems": 1,
                        "type": "array",
                        "description": "One or more subreddit names WITHOUT the r/ prefix, e.g. ['fitness', 'webdev', 'smallbusiness']. 1-10 recommended.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "intentKeywords": {
                        "title": "Intent keywords (optional)",
                        "type": "array",
                        "description": "Optional list of intent patterns beyond the built-in set. These are matched as substring/word-fragments inside post titles and bodies. Examples: ['crm for', 'project management tool', 'invoicing app'].",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "timeframe": {
                        "title": "Timeframe",
                        "type": "string",
                        "description": "How far back to search. One of: 'hour', 'day', 'week', 'month', 'year', 'all'. Default 'month'.",
                        "default": "month"
                    },
                    "maxPosts": {
                        "title": "Max matching posts to return",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Cap on posts returned. Higher = more results, slower run. Default 50.",
                        "default": 50
                    },
                    "maxPostsPerSub": {
                        "title": "Max posts to scan per subreddit",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "How many posts to fetch per subreddit before intent-filtering. Default 100. Reddit caps at 100 per page; pagination is internal.",
                        "default": 100
                    },
                    "matchBody": {
                        "title": "Also scan post body (selftext)",
                        "type": "boolean",
                        "description": "If true, intent matching also scans the post's selftext in addition to the title. Off by default to reduce noise.",
                        "default": false
                    },
                    "minScore": {
                        "title": "Minimum post upvote score",
                        "minimum": 0,
                        "type": "integer",
                        "description": "If set, only posts with at least this many upvotes are kept. Useful to filter out low-effort/troll posts. Default 0 (no filter).",
                        "default": 0
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
