# Dataset Diff & Alert Monitor (`mdcurt/dataset-diff-monitor`) Actor

Run any Actor or read any dataset, diff it against the last run by key, and push added / changed / removed rows to a webhook, Telegram, Discord or Slack. Pay per row compared and per notification.

- **URL**: https://apify.com/mdcurt/dataset-diff-monitor.md
- **Developed by:** [Matthew Curtis](https://apify.com/mdcurt) (community)
- **Categories:** Automation, Developer tools, Integrations
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 row compareds

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

## Dataset Diff & Alert Monitor

Turn any Apify Actor or dataset into a change monitor. Run it on a schedule: it runs your source Actor (or reads a dataset you already have), compares the result with the last run by a key you choose, and sends the **added, changed and removed** rows to a webhook, Slack, Discord or Telegram. Every change is also written to the run's dataset, so n8n, Make, Zapier or your own code can pick it up.

No scraping of its own, no browser, no proxies. You pay per row compared and per message sent; the source Actor is billed at its own price.

### What it is for

- **New job postings** — run a LinkedIn, Indeed, Dice or Greenhouse jobs Actor daily and get only the new postings in Slack.
- **Price and stock watch** — run a product scraper twice a week; `watchFields: ["price", "inStock"]` reports only those changes, with the previous value.
- **New tenders, permits, listings, grants** — any registry scraper becomes an alert feed.
- **Review and rating watch** — new reviews on Google Maps, Trustpilot or the app stores.
- **Compare two datasets once** — pass `previousDatasetId` to diff any two datasets without a schedule.

### How it works

1. **Source** — set `sourceActorId` (`username/actor-name`) plus `sourceInput`, or `sourceTaskId`, or an existing `datasetId`.
2. **Key** — `keyFields` identify an item across runs: `["url"]`, `["id"]`, `["title","company"]`. Nested paths like `product.sku` work.
3. **Diff** — items are hashed on their watched fields. `ignoreFields` drops fields that change every run (`scrapedAt`, `rank`); `watchFields` restricts changes to the fields you care about.
4. **Snapshot** — the current state is saved in a named key-value store (`snapshotStoreName`, default `dataset-diff-monitor`) under `snapshotKey`. Leave the key empty and one is derived from the source and its input, so each schedule gets its own.
5. **Notify** — a digest goes to every configured channel; the generic webhook gets a JSON body with the summary and the rows.

The first run stores the baseline silently (`firstRunBehavior: "snapshot"`) or reports every item as added (`"notify"`).

### Input example

```json
{
  "sourceActorId": "curious_coder/linkedin-jobs-scraper",
  "sourceInput": { "title": "data engineer", "location": "Chicago", "rows": 100 },
  "keyFields": ["id"],
  "ignoreFields": ["scrapedAt", "postedAt"],
  "notifyOn": ["added"],
  "labelField": "title",
  "urlField": "link",
  "slackWebhookUrl": "https://hooks.slack.com/services/…"
}
```

Schedule this Actor, not the source Actor: the monitor runs the source for you.

### Worked examples

Each of these pairs the monitor with one of the author's source Actors; swap in any Store Actor the same way.

| Alert you want | Source Actor | Monitor input (beyond your channel) |
| --- | --- | --- |
| New stories for a keyword, hourly — a Google Alerts you control | [google-news-scraper](https://apify.com/mdcurt/google-news-scraper) | `"sourceInput": {"queries": ["\"Acme Corp\""], "timeRange": "1d", "maxItems": 100}, "keyFields": ["id"], "notifyOn": ["added"], "labelField": "title", "urlField": "url"` |
| A competitor app ships a version, moves rating or changes price | [google-play-app-scraper](https://apify.com/mdcurt/google-play-app-scraper) | `"sourceInput": {"queries": ["com.duolingo"], "locale": "en-US", "maxItems": 1}, "keyFields": ["id"], "watchFields": ["version", "score", "price", "updatedAt"], "notifyOn": ["changed"], "labelField": "title", "urlField": "url"` |
| New or changed Washington DNR timber sales before the auction | [wa-dnr-timber-sales](https://apify.com/mdcurt/wa-dnr-timber-sales) | `"sourceInput": {"listings": ["upcoming", "unsold"]}, "keyFields": ["id"], "notifyOn": ["added", "changed"], "labelField": "saleName", "urlField": "packetUrl"` |
| New Minnesota DNR auctions and posted results | [mn-dnr-timber-sales](https://apify.com/mdcurt/mn-dnr-timber-sales) | `"sourceInput": {"includeCalendar": true}, "keyFields": ["id"], "notifyOn": ["added", "changed"], "labelField": "saleName", "urlField": "detailUrl"` |
| New or repriced kleinanzeigen.de ads for a search | [kleinanzeigen-scraper](https://apify.com/mdcurt/kleinanzeigen-scraper) | `"sourceInput": {"queries": ["rennrad"], "location": "Köln", "fetchDetails": false, "maxItems": 100}, "keyFields": ["id"], "watchFields": ["price"], "notifyOn": ["added", "changed"], "labelField": "title", "urlField": "url"` |

### Output

**Dataset** — one row per change the run reports:

```json
{
  "changeType": "changed",
  "key": "https://example.com/item/42",
  "label": "Item 42",
  "url": "https://example.com/item/42",
  "changedFields": ["price"],
  "item": { "url": "https://example.com/item/42", "price": 19.99 },
  "previous": { "url": "https://example.com/item/42", "price": 24.99 },
  "detectedAt": "2026-10-24T19:47:51.899Z",
  "snapshotKey": "snap-3f1c9a2b7e4d1c0a",
  "sourceDatasetId": "…",
  "sourceRunId": "…"
}
```

**Key-value store `OUTPUT`** — the run summary: counts, what it was compared against, which channels were notified, and the snapshot key.

**Webhook body** — `{ title, detectedAt, summary: {added, changed, removed, unchanged, compared}, added: [...], changed: [...], removed: [...], truncated }`. Rows per type are capped at `maxItemsPerMessage` (default 20); the dataset always holds all of them.

**Chat digest** (Slack, Discord, Telegram):

```
Diff monitor: curious_coder/linkedin-jobs-scraper: 4 added, 2 changed, 3 removed (44 items compared)

ADDED (4)
• Senior Data Engineer https://…
…
CHANGED (2)
• Data Engineer II — salary https://…
```

Discord messages are split at 2,000 characters, Telegram at 4,000.

### Pricing

Pay per event, no platform usage charges on top:

| Event | Price |
| --- | --- |
| Actor start | $0.02 |
| Row compared (current items + removed items) | $0.001 |
| Notification message sent | $0.01 |

A daily monitor over 500 items with one Slack digest costs about $0.53 per run plus the source Actor's own price. Reading an existing dataset instead of running a source Actor costs only the comparison.

### Use from n8n, Make, MCP or code

- **n8n / Make** — add the Apify node, pick this Actor, paste the input JSON. Or let the Actor call your workflow's webhook URL directly through `webhookUrl`.
- **MCP** — `https://mcp.apify.com/?tools=mdcurt/dataset-diff-monitor`
- **API** — `POST https://api.apify.com/v2/acts/mdcurt~dataset-diff-monitor/runs?token=…` with the input as the body.

### Limits and notes

- Items with no value in any key field are skipped and counted in `OUTPUT.counts.skippedNoKey`.
- Duplicate keys keep the last item; the count is reported.
- Snapshots above ~8 MB keep hashes only, so `previous` is empty in changed rows for very large datasets. Use `watchFields` to shrink what is compared.
- A failing channel does not block the others; failures are listed in `OUTPUT.notifications.failed`.
- `dryRun: true` computes and writes the diff but sends nothing and leaves the snapshot untouched.

### Why this exists

Freelance boards in October 2026 kept asking for the same thing with different sources: a multi-site stock alert bot, a daily digest of CIO job postings across four boards, a procurement watcher that alerts on new solicitations. Each of those is a source Actor plus this monitor.

# Actor input Schema

## `sourceActorId` (type: `string`):

Actor to run before diffing, as `username/actor-name` or an Actor ID. Its run is charged to your account at that Actor's own price. Leave empty to diff an existing dataset instead.

## `sourceInput` (type: `object`):

Input JSON passed to the source Actor.

## `sourceTaskId` (type: `string`):

Alternative to Source Actor: a saved Task (`username/task-name` or ID) to run. Its stored input is used unless Source Actor input is also set.

## `sourceTimeoutSecs` (type: `integer`):

How long to wait for the source Actor or Task before giving up.

## `datasetId` (type: `string`):

Dataset ID or name to diff when no source Actor or Task is set. Also used as the override when you want to diff a specific run's dataset.

## `previousDatasetId` (type: `string`):

Optional. Diff `Dataset to diff` against this dataset instead of the stored snapshot. The stored snapshot is still updated afterwards.

## `keyFields` (type: `array`):

Field(s) that identify an item across runs, e.g. `url`, or `id`, or `title` + `company`. Nested paths like `product.sku` work. Items missing every key field are skipped and counted in the summary.

## `watchFields` (type: `array`):

Optional. Only a change in one of these fields counts as `changed`. Empty means every field except the ignored ones.

## `ignoreFields` (type: `array`):

Fields that change every run but do not matter, e.g. `scrapedAt`, `position`, `rank`.

## `notifyOn` (type: `array`):

Which change types trigger a notification and are written to the output dataset.

## `firstRunBehavior` (type: `string`):

There is no snapshot on the first run. `snapshot` stores the baseline silently; `notify` treats every item as added.

## `snapshotStoreName` (type: `string`):

Named key-value store that keeps the last snapshot. One store can hold snapshots for many monitors.

## `snapshotKey` (type: `string`):

Key for this monitor's snapshot inside the store. Leave empty to derive one from the source Actor/Task/dataset and the source input, so each distinct monitor gets its own key automatically.

## `title` (type: `string`):

Name shown at the top of every message, e.g. `Chicago data-engineer jobs`. Defaults to the source name.

## `labelField` (type: `string`):

Field shown as the item's name in messages, e.g. `title` or `name`. Falls back to the key.

## `urlField` (type: `string`):

Field holding a link to the item, included in messages when present.

## `webhookUrl` (type: `string`):

Any HTTPS endpoint (n8n, Make, Zapier, your API). Receives one JSON POST with the summary and the changed rows.

## `slackWebhookUrl` (type: `string`):

Posts a text digest to a Slack channel.

## `discordWebhookUrl` (type: `string`):

Posts a text digest to a Discord channel. Long digests are split into 2,000-character messages.

## `telegramBotToken` (type: `string`):

Token from @BotFather. Requires Telegram chat ID too.

## `telegramChatId` (type: `string`):

Chat, group or channel ID the bot posts to.

## `maxItemsPerMessage` (type: `integer`):

How many items to list per change type in chat digests and the webhook body. The output dataset always holds every change.

## `notifyWhenNoChanges` (type: `boolean`):

Send a short 'no changes' message so you know the monitor ran.

## `dryRun` (type: `boolean`):

Compute and write the diff but send no notifications and do not update the snapshot.

## Actor input object example

```json
{
  "sourceInput": {},
  "sourceTimeoutSecs": 3600,
  "keyFields": [
    "url"
  ],
  "ignoreFields": [
    "scrapedAt",
    "crawledAt",
    "timestamp"
  ],
  "notifyOn": [
    "added",
    "changed",
    "removed"
  ],
  "firstRunBehavior": "snapshot",
  "snapshotStoreName": "dataset-diff-monitor",
  "labelField": "title",
  "urlField": "url",
  "maxItemsPerMessage": 20,
  "notifyWhenNoChanges": false,
  "dryRun": false
}
```

# Actor output Schema

## `changes` (type: `string`):

One row per added, changed or removed item, with previous values and changed fields

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

Counts, what the run was compared against, snapshot key and notification results

# 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 = {
    "sourceInput": {},
    "keyFields": [
        "url"
    ],
    "ignoreFields": [
        "scrapedAt",
        "crawledAt",
        "timestamp"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mdcurt/dataset-diff-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 = {
    "sourceInput": {},
    "keyFields": ["url"],
    "ignoreFields": [
        "scrapedAt",
        "crawledAt",
        "timestamp",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("mdcurt/dataset-diff-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 '{
  "sourceInput": {},
  "keyFields": [
    "url"
  ],
  "ignoreFields": [
    "scrapedAt",
    "crawledAt",
    "timestamp"
  ]
}' |
apify call mdcurt/dataset-diff-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mdcurt/dataset-diff-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/GbPGocdoo1SgRbzye/builds/1rHkrCbToLEjVRds9/openapi.json
