# Hacker News Monitor — Keyword Alerts for Stories & Comments (`harvestworks/hacker-news-monitor`) Actor

Get new Hacker News stories and comments that mention your brand, product, or competitors. Exact-phrase matching, and scheduled runs return only mentions you haven't seen.

- **URL**: https://apify.com/harvestworks/hacker-news-monitor.md
- **Developed by:** [Tucker Watts](https://apify.com/harvestworks) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 mentions

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

## Hacker News Monitor — Keyword Alerts for Stories & Comments

Get new Hacker News stories and comments that mention your brand, product, competitors, or any phrase. Schedule it and each run returns **only mentions you haven't seen yet**.

- **Exact-phrase matching.** "postgres" won't match "posters", and "open source" matches only that phrase, not the two words anywhere in a comment.
- **Alerts, not dumps.** On a schedule, you get only new mentions and pay only for those. A run with nothing new costs just the run start.
- **One row per item.** A comment that matches two of your keywords is returned and charged once.
- **Fast and light.** Uses the public HN Search API. No browser, no proxies, no login.

### What you can do with it

- Get alerted when someone mentions your product or company on Hacker News, so you can join the discussion.
- Track what HN says about your competitors.
- Watch for launches, "Show HN" posts, or discussions about a technology you care about.
- Feed new mentions to Slack, email, or an AI agent for summaries and sentiment.

### Input

| Field | Required | Description |
|---|---|---|
| `keywords` | yes | Words or phrases, each matched as an exact phrase (case-insensitive). Up to 20 per run. |
| `searchIn` | no | `both` (default), `stories`, or `comments`. |
| `sinceHours` | no | Only items from the last N hours, 1–720 (30 days). Default `24`. |
| `minPoints` | no | Only stories with at least this many points. Comments are not filtered. |
| `onlyNew` | no | Skip items a previous run with the same keywords already returned. Default `true`. |

```json
{
  "keywords": ["postgres", "supabase", "neon database"],
  "searchIn": "both",
  "sinceHours": 24
}
```

**Monitoring:** schedule this input hourly or daily. The first run returns the last 24 hours; each later run returns only what's new.
**One-off search:** set `onlyNew` to `false` and `sinceHours` to the window you want.

### Output

One row per story or comment, newest first per keyword:

```json
{
  "type": "mention",
  "keyword": "postgres",
  "kind": "story",
  "id": "49840594",
  "hnUrl": "https://news.ycombinator.com/item?id=49840594",
  "title": "700 MB/s of Kafka throughput, on Postgres",
  "url": "https://rynr.dev/blog/700mbskafgres/",
  "text": null,
  "points": 4,
  "numComments": 0,
  "storyId": "49840594",
  "parentId": null,
  "createdAt": "2026-09-25T05:49:26Z"
}
```

For comments, `kind` is `"comment"`, `text` is the comment as plain text, `title` and `url` are those of the story it was posted under, and `points` and `numComments` are `null` (HN doesn't publish comment scores). `hnUrl` always links to the item on Hacker News. Author usernames are not included.

#### Errors: free rows

```json
{ "type": "error", "target": "x", "reason": "invalid_input", "message": "Keyword \"x\" is too short." }
```

`reason` is one of `invalid_input`, `blocked`, `rate_limited`, `network_error`. A per-keyword run summary is saved to the `OUTPUT` record of the run's key-value store.

### Pricing

Pay per event: **$2 per 1,000 mentions** ($0.002 each), plus $0.002 per run start. `error` rows are free, and with `onlyNew` you never pay twice for the same mention.

Set a **maximum charge per run** to cap spending. When the run reaches it, it stops cleanly and says so. Mentions that didn't fit are returned on the next run.

### Limits

- Up to 20 keywords per run and a look-back of up to 30 days.
- At most 1,000 stories and 1,000 comments per keyword per run (a limit of the HN Search API). For very common words, the run summary says when this cut results off; use a shorter look-back or a more specific phrase.
- Author usernames are left out by design.

### Use with AI agents

The input and output are flat and predictable. The `type` field on every row tells mentions and errors apart, and every error has a fixed `reason` code. An agent can call this Actor with just `keywords`.

# Actor input Schema

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

Words or phrases to watch for, e.g. your product, company, or competitors. Each is matched as an exact phrase (case-insensitive, no fuzzy matching). Up to 20 per run.

## `searchIn` (type: `string`):

Which Hacker News items to search.

## `sinceHours` (type: `integer`):

Only items posted in the last N hours (1-720, i.e. up to 30 days).

## `minPoints` (type: `integer`):

Only stories with at least this many points. Does not filter comments.

## `onlyNew` (type: `boolean`):

Skip items a previous run with the same keywords already returned. On by default for API calls and schedules; unchecked in this form so a first try shows results. Turn it on when you schedule the Actor (e.g. hourly or daily) to get only new mentions.

## Actor input object example

```json
{
  "keywords": [
    "postgres",
    "open source"
  ],
  "searchIn": "both",
  "sinceHours": 24,
  "onlyNew": true
}
```

# Actor output Schema

## `results` (type: `string`):

All rows. Each row's "type" is "mention" or "error".

## `mentionsTable` (type: `string`):

Key mention fields.

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

Per-keyword status, result counts, and whether the max charge limit stopped the run.

# 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 = {
    "keywords": [
        "postgres",
        "open source"
    ],
    "sinceHours": 24,
    "onlyNew": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("harvestworks/hacker-news-monitor").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 = {
    "keywords": [
        "postgres",
        "open source",
    ],
    "sinceHours": 24,
    "onlyNew": False,
}

# Run the Actor and wait for it to finish
run = client.actor("harvestworks/hacker-news-monitor").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 '{
  "keywords": [
    "postgres",
    "open source"
  ],
  "sinceHours": 24,
  "onlyNew": false
}' |
apify call harvestworks/hacker-news-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,harvestworks/hacker-news-monitor"
        }
    }
}
```

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/7bi6Cac933bV7vaum/builds/q6Gyyr6P4FqVSB6F9/openapi.json
