Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

Building a Change & Alert Engine That Webhooks Any Diff on Any URL

Most data jobs re-pull the whole source every run and waste time and money on data that didn't move. A change-detection engine wakes up, checks what actually changed, and pushes only the diff. I built a generic one: point it at any URL — a JSON feed, an RSS/Atom feed, or a plain HTML page — and it emits only the changes, with before and after values, to the dataset and/or your webhook. How it…

Most data jobs re-pull the entire source on every run, wasting time and money on unchanged data. To address this, I developed a generic change-detection engine that wakes up, checks what has changed, and pushes only the difference. This engine can be pointed at any URL—be it a JSON feed, RSS/Atom feed, or plain HTML page—and will emit only the changes, along with before and after values, to a dataset or a webhook.

The engine operates by polling the source URL once per defined schedule, automatically sniffing the content format. JSON arrays are used directly, while object feeds automatically detect common list keys. RSS/Atom feeds are parsed using stable IDs (guid or link), and HTML content is transformed into a single monitored item keyed on a content hash.

Each item receives a stable item_id, sourced from an idField, natural keys like guid or link, or a content-hash fallback. A new ID signifies an addition; the same ID with a different hash indicates a modification, complete with before and after values; a missing ID signals removal (only when includeRemovals: true). The changed items are emitted to the dataset, one per item, plus one batched webhook POST containing all changes for that run. No data is emitted on a clean poll, ensuring no alerts are silently lost.

The engine guarantees at-least-once delivery. State is persisted only after a successful webhook POST (or immediately if no webhook is configured). In the event of a failed POST, the run fails, and the next run re-emits the same changes. Duplicate item IDs within a single run collapse to the last occurrence, preventing double-notifications in feeds that repeat entries.

A common pitfall is the default key-value store in Apify, which is per-run for API-started runs. To prevent data loss between runs, a named store must be used—Actor.open_key_value_store(name=change-alert-state)—which persists across runs.

To test this engine, I used the BBC News RSS feed. On the first run, 41 items were added. On subsequent runs, no changes were detected—zero items were added, confirming the engine's effectiveness. With a controlled source (an Apify dataset with a pre-signed public URL), run A added two items, appending a modified g2 and a new g3. Run B accurately reported the modification of g2 (price from 20 to 25) along with the addition of g3. Run C confirmed no changes, returning 0 items.

Some considerations: items lacking a natural ID fall back to a content hash, leading to an add+remove pair for any edit. In feeds with volatile timestamps, you can ignore specific fields by listing them in ignoreFields, ensuring only relevant changes are reported.

To try this engine, visit the Change & Alert Engine on the Apify Store. For more insights, check out my other articles on topics ranging from scraping business directories to building AI web crawlers.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

React Portals: How They Work and When to Use Them for Modals and Tooltips

You’ve probably built a modal or tooltip in React and hit a weird snag: the overlay appears visually outside your usual component tree, but events don’t behave as you expect.

  • React portals render children outside normal DOM tree position.
  • Portalized components like modals, tooltips benefit from divs outside root container.
  • Proper event handling and focus management required for portalized UI elements.

Spotify App Adds a List of New Features

Spotify has added a whole bunch of new features for its app, including Playlist Notes, Running Mode, and more. Playlist … Read More The post Spotify App Adds a List of New Features appeared first on…

I Built a Drag-and-Drop Kanban Board with Vanilla JavaScript

If you've ever wanted to understand how drag-and-drop actually works under the hood — no libraries, no frameworks, just the browser — building a Kanban board is a great way to find out.

  • Three-column Kanban board created with HTML, CSS, JavaScript
  • Drag-and-drop functionality implemented using HTML5 Drag and Drop API
  • Event listeners handle card movement between To Do, In Progress, and Done columns

More from Wednesday 19 August →