# Hacker News Keyword Monitor — Deduplicated Stories & Comments (`natstandridge/hacker-news-discussion-monitor`) Actor

Batch-monitor Hacker News stories and comments across multiple keyword queries in one call, deduplicating overlapping hits. Returns itemId, itemType, title, text, discussionUrl, points, commentCount, changeStatus, and matchEvidence. Pay-Per-Event $0.003/item ($3.00/1k), zero cookies.

- **URL**: https://apify.com/natstandridge/hacker-news-discussion-monitor.md
- **Developed by:** [Nathaniel Standridge](https://apify.com/natstandridge) (community)
- **Categories:** Social media, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 matched hacker news discussions

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 Keyword Monitor

Search a batch of keywords across recent Hacker News stories and comments. Each delivered discussion includes `itemId`, `itemType`, `title`, `text`, `discussionUrl`, `matchEvidence` and costs **$0.003**. Pass the last snapshot to receive only new or edited discussions.

The free HN Search API is useful for individual searches. This Actor adds a repeatable monitoring workflow: overlapping query deduplication, literal match evidence, normalized text, fixed time windows, explicit coverage diagnostics and a caller-owned checkpoint that does not advance past undelivered results.

### Start with a useful sample

```json
{
  "keywords": ["postgresql", "sqlite"],
  "itemType": "both",
  "lookbackDays": 7,
  "maxResults": 15,
  "maxPagesPerQuery": 2,
  "maxRequests": 15
}
```

1. Run the sample and open the dataset. Each row is one matching discussion, even when multiple keywords matched it.
2. Read `matchedQueries`, `matchEvidence`, `text` and `storyTitle`; use `discussionUrl` to review the original conversation.
3. Open the `OUTPUT` record for coverage, errors and `nextSnapshot`. A result cap is reported as partial rather than presented as complete coverage.
4. For the next daily run, copy `OUTPUT.nextSnapshot` into `previousItems` and set `changesOnly` to `true`. An explicit empty array starts a new baseline.
5. Use `itemId` as the upsert key in your spreadsheet or database. Pass the next snapshot forward only after handling the delivered rows.

The Actor itself creates no schedule or messages. Configure an Apify schedule, task or integration separately when you want recurring runs.

### What you receive

| Field | Meaning |
| --- | --- |
| `itemId` | Stable Hacker News story or comment ID, represented as a string. |
| `itemType` | `story` or `comment`. |
| `title`, `text` | Plain text. Story titles may be present without a body; comments use `text`. |
| `matchedQueries`, `matchEvidence` | Input keywords and the delivered fields containing their literal case-insensitive match. |
| `discussionUrl` | Original Hacker News discussion or comment permalink. |
| `storyId`, `storyTitle`, `storyUrl` | Parent story context when available. `storyUrl` is the HN thread, not an external page. |
| `sourceUrl` | External article link supplied by the source, if available. Links are never crawled. |
| `points`, `commentCount` | Story engagement values from the index; `null` for comments. |
| `createdAt`, `observedAt` | Original creation date and the fixed UTC observation timestamp. |
| `contentHash`, `changeStatus` | Content fingerprint and `new`, `updated` or `unchanged` compared with your baseline. |
| `observationId` | Deterministic item/content key used to reconcile delivery within a run. |
| `textTruncated` | Whether the body exceeded the 12,000-character output limit. |

Example from a public source check on November 5, 2026 (fields shortened here; the full schema is available in the Actor):

```json
{
  "itemId": "50382763",
  "itemType": "story",
  "title": "Burnt TOAST: performance considerations for large values in PostgreSQL",
  "matchedQueries": ["postgresql"],
  "matchEvidence": [{"query": "postgresql", "fields": ["title"]}],
  "changeStatus": "new",
  "discussionUrl": "https://news.ycombinator.com/item?id=50382763"
}
```

### Pricing

**$3.00 per 1,000 delivered discussions ($0.003 each).** The 15-result sample costs up to $0.045 in Actor events. The default maximum charge is $0.05. Empty results and duplicate matches incur no event charge.

One native dataset event is charged for each delivered row. Overlapping query matches are charged once. Empty searches, failed source requests, rejected hits, diagnostics and unchanged rows skipped with `changesOnly: true` have no result charge. When `changesOnly` is false, delivered unchanged rows are charged like other delivered rows.

### Matching and change detection

- Results come from Algolia's Hacker News search index, ordered newest first. Up to ten case-insensitively distinct keywords are supported; exact repeated keywords are merged.
- Retrieved hits must also contain a literal case-insensitive match in their normalized title or delivered text. Stories can additionally match their own external URL. Comment matches do not come only from a parent's title, URL or author's username. The source search is an upstream retrieval filter, so this is not an exhaustive substring scan of all Hacker News content.
- `minPoints` filters stories only. Comment scores are unavailable and remain `null`.
- The content fingerprint covers normalized title/body, story title and external link. Engagement counts and observation time do not trigger `updated`. A body can be truncated for delivery while its complete normalized source content contributes to the fingerprint.
- `previousItems` contains only `itemId` and `contentHash`. There is no hidden baseline shared between customers or runs. `nextSnapshot` advances only delivered rows and already-unchanged rows; undelivered older keys remain intact.
- Missing items never mean deleted. The snapshot retains prior keys outside the current window. Its maximum size is 10,000 entries; at capacity new keys are deferred without a charge. Prune older keys deliberately or start a new baseline when needed.

### Coverage and limits

The creation-date window is `[windowStart, windowEndExclusive)`. `lookbackDays` defaults to seven, up to 365; an explicit ISO timestamp in `since` overrides it. Edits to older discussions are detected only when those discussions still appear in the selected creation-date window and source results.

Each page contains up to 100 source hits. The Actor fetches at most ten pages and 1,000 accessible hits per keyword. It does not bypass the search service's retrieval cap. Queries run round-robin so the first keyword cannot consume every page before the others start.

Defaults are three pages per keyword, 100 delivered rows and 35 total GET attempts including robots and retries. Maximums are 1,000 delivered rows and 120 GET attempts. A 120-second work deadline reserves 25 seconds for delivery. The persisted result plan is bounded to 8 MB; oversized text-heavy batches report `plan_size_limit`.

`OUTPUT.complete` is true only when all reported source pages were fetched, distinct source IDs agree with exact hit counts, no input/source records were invalid, and every planned result was delivered without a limit. Repeated or overlapping source pages within one keyword stop that query and report incomplete coverage; overlap between different keyword searches is normal deduplication. It does not prove the index contains every HN item. Source indexing delay, deleted/dead items, ranking changes and pagination movement can affect results. Invalid or deleted/dead hits are not billed. `queryStats`, `filteredHits`, `invalidHits`, `errors` and `stopReason` explain the observed coverage.

### Reliability and privacy

Only the fixed public `hn.algolia.com` search API and its robots file are requested. DNS must resolve exclusively to public addresses; requests pin a validated address and reject redirects. No supplied URL or result link is fetched. Safe GET retries share the request budget and respect `Retry-After`; source rate limiting stops collection.

Results are frozen before billable delivery. Ambiguous dataset appends are not automatically repeated; a resumed run reconciles stored rows and native charge counts. If a prior append cannot be confirmed, the run fails with an explicit incomplete-delivery diagnostic rather than risking a duplicate charge.

No login, browser, proxy subscription, AI service or external API key is required. No author profile or contact enrichment is performed. Public discussion text can itself contain personal information; collect and retain only what your workflow needs.

### Sources

- [HN Search API documentation](https://hn.algolia.com/api)
- [Algolia's HN Search implementation](https://github.com/algolia/hn-search)
- [Original Hacker News discussion for the example](https://news.ycombinator.com/item?id=50382763)

The source repository is archived. This Actor depends on the public search service remaining available; it does not guarantee index freshness or uninterrupted access.

### Quick Integration (Apify MCP, n8n, Make & Python SDK)

#### 1. Apify MCP (`https://mcp.apify.com`) — Claude, Cursor, OpenAI Agents & ADK

Connect your AI agent directly to `https://mcp.apify.com/?actors=natstandridge/hacker-news-discussion-monitor` (synchronous <25s default prefill, `LIMITED_PERMISSIONS`, `$0.003`/event Pay-Per-Event):

```json
{
  "mcpServers": {
    "apify-hacker-news-discussion-monitor": {
      "url": "https://mcp.apify.com/?actors=natstandridge/hacker-news-discussion-monitor",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

#### 2. n8n Workflow (Apify / HTTP Request Node)

- **Method / URL:** `POST https://api.apify.com/v2/acts/natstandridge~hacker-news-discussion-monitor/run-sync-get-dataset-items`
- **Header:** `Authorization: Bearer {{ $env.APIFY_TOKEN }}`
- **JSON Body:**

```json
{
  "keywords": [
    "mcp",
    "apify"
  ],
  "maxResults": 15
}
```

#### 3. Make.com & Python SDK (`apify-client`)

In **Make.com**, select the **Apify -> Run an Actor** module for `natstandridge/hacker-news-discussion-monitor` (enable *Run synchronously*) followed by **Apify -> Get Dataset Items**. Or in Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("natstandridge/hacker-news-discussion-monitor").call(run_input={"keywords": ["mcp", "apify"], "maxResults": 15})
items = list(client.dataset(run.default_dataset_id).iterate_items())
```

# Actor input Schema

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

1–10 words or phrases. Literal case-insensitive matching in returned title/text; stories also match their source URL. Overlapping queries produce one discussion row. Duplicate queries are merged.

## `itemType` (type: `string`):

Comments include parent story context when provided by the index; no user profile requests.

## `since` (type: `string`):

ISO 8601 timestamp with timezone. Overrides lookbackDays. Window ends just before the run's fixed collection timestamp, using creation date rather than edit date.

## `lookbackDays` (type: `integer`):

Creation-date window used when since is absent. Index limits can truncate busy or broad searches.

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

Applied only to stories. Comments keep points=null and remain eligible.

## `maxResults` (type: `integer`):

Newest deduplicated eligible matches. Query diagnostics and completion flags remain in OUTPUT. Charging cap can lower this further.

## `maxPagesPerQuery` (type: `integer`):

100 source hits per page. Source supports at most 1000 accessible hits per query. Queries are paged round-robin.

## `maxRequests` (type: `integer`):

Total GET attempts including robots and safe-read retries. Hitting this bound is explicitly incomplete.

## `requestTimeoutSeconds` (type: `integer`):

Hard bound per DNS/TLS/response attempt. Up to two safe-read retries within the total request/work budget.

## `maxRunSeconds` (type: `integer`):

Collection reserves 25 seconds for frozen-plan storage and delivery; storage operations have independent short bounds.

## `previousItems` (type: `array`):

Paste the exact nextSnapshot array from the previous run. Caller-owned, no cross-run hidden state. Up to 10000 keys; unmatched previous entries are retained and never treated as deleted.

## `changesOnly` (type: `boolean`):

Requires previousItems explicitly (an empty array is valid). Unchanged content is skipped and uncharged; score/comment-count changes alone do not count as edits.

## Actor input object example

```json
{
  "keywords": [
    "postgresql",
    "sqlite"
  ],
  "itemType": "both",
  "lookbackDays": 7,
  "minPoints": 0,
  "maxResults": 15,
  "maxPagesPerQuery": 3,
  "maxRequests": 35,
  "requestTimeoutSeconds": 15,
  "maxRunSeconds": 120,
  "changesOnly": false
}
```

# Actor output Schema

## `discussions` (type: `string`):

No description

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

No description

# 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": [
        "postgresql",
        "sqlite"
    ],
    "maxResults": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("natstandridge/hacker-news-discussion-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": [
        "postgresql",
        "sqlite",
    ],
    "maxResults": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("natstandridge/hacker-news-discussion-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": [
    "postgresql",
    "sqlite"
  ],
  "maxResults": 15
}' |
apify call natstandridge/hacker-news-discussion-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,natstandridge/hacker-news-discussion-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/fIsOMzXgTLpRFwD7b/builds/5SxtYXjUe6RrAadZe/openapi.json
