DEV Community

Elowen
Elowen

Posted on

Build an n8n Workflow to Track Organic Result Changes

Manual SERP checks do not scale well. You search a keyword, look at the top results, maybe take a screenshot, and then repeat the same thing tomorrow. The problem is not the first check. The problem is remembering exactly what changed.

For a small monitoring workflow, I like starting with n8n: one scheduled trigger, one API request, one normalization step, and one comparison step. This walkthrough builds a simple n8n workflow that calls TalorData SERP API, extracts organic results, and compares the latest snapshot with a previous snapshot.

Workflow shape

The first version has five parts:

  1. Schedule Trigger
  2. Set node for query settings
  3. HTTP Request node for SERP data
  4. Code node to normalize organic results
  5. Code node to compare current and previous results

You can add storage, Slack, email, or Google Sheets later. The important part is to make the change logic clear before adding notifications.

Step 1: Create the query settings

Add a Set node after the Schedule Trigger. Create fields like:

query = google search api
engine = google
num = 10
Enter fullscreen mode Exit fullscreen mode

If you plan to monitor multiple queries, keep the first workflow to one query until the data shape is stable. Batch mode is easier after the single-query version works.

Step 2: Add the HTTP Request node

Use a POST request.

https://serpapi.talordata.net/serp/v1/request
Enter fullscreen mode Exit fullscreen mode

Headers:

Authorization: Bearer <TALORDATA_TOKEN>
Content-Type: application/x-www-form-urlencoded
Enter fullscreen mode Exit fullscreen mode

Body parameters:

engine=google
q={{ $json.query }}
num={{ $json.num }}
json=2
Enter fullscreen mode Exit fullscreen mode

The response should be JSON. For this workflow, the main field we care about is organic.

Step 3: Normalize organic results

Add a Code node after the HTTP Request node. Keep a compact shape that is easy to compare:

const organic = $json.organic || [];

return organic.map((item) => ({
  json: {
    position: item.position,
    title: item.title,
    link: item.link,
    description: item.description,
  },
}));
Enter fullscreen mode Exit fullscreen mode

This avoids comparing the entire SERP response. For change detection, a small normalized record is easier to debug.

Step 4: Store the previous snapshot

For a real workflow, you need somewhere to keep the previous run. Good first options are Google Sheets, Airtable, Postgres, or n8n static data for a small prototype.

The snapshot should include:

query
fetched_at
position
title
link
description
Enter fullscreen mode Exit fullscreen mode

Step 5: Compare current and previous results

Create a key from the URL, then check whether each URL is new, removed, or moved.

const current = $input.all().map((item) => item.json);

// Replace this with records loaded from your storage node.
const previous = [];

const previousByLink = new Map(previous.map((item) => [item.link, item]));
const currentByLink = new Map(current.map((item) => [item.link, item]));

const changes = [];

for (const item of current) {
  const old = previousByLink.get(item.link);

  if (!old) {
    changes.push({ type: "new_result", link: item.link, title: item.title, position: item.position });
    continue;
  }

  if (old.position !== item.position) {
    changes.push({ type: "position_changed", link: item.link, title: item.title, previous_position: old.position, current_position: item.position });
  }
}

for (const item of previous) {
  if (!currentByLink.has(item.link)) {
    changes.push({ type: "removed_result", link: item.link, title: item.title, previous_position: item.position });
  }
}

return changes.map((change) => ({ json: change }));
Enter fullscreen mode Exit fullscreen mode

Avoid noisy alerts

Do not send a notification for every tiny movement. Useful rules might be: alert when a new domain enters the top 10, alert when a tracked competitor moves into the top 5, alert when your page disappears from the first page, or log minor position changes without notifying anyone.

Most bugs in this type of workflow are data-shape bugs, not API-call bugs. Inspect the raw response, normalized output, previous snapshot, generated changes, and final alert payload before adding notifications.

An n8n SERP monitor does not need to be complicated. Start by making the search snapshot repeatable, then make the diff readable, then decide which changes deserve attention.

If you want to test the same workflow with live Google results, new TalorData accounts include 500 responses for a small first monitor.

Top comments (0)