DEV Community

Elowen
Elowen

Posted on

Batch Google SERP Queries with n8n and Form Data

A single SERP query is useful for debugging. A keyword list is where the workflow becomes useful for research.

If you have 20, 50, or 100 keywords, you do not want to paste each one into a search tool by hand. You want a repeatable workflow that accepts a list, runs each query, saves the result, and gives you a structured output for review.

This tutorial shows a simple n8n pattern: submit keywords through a form, loop through them, call TalorData SERP API, and return normalized SERP records.

Workflow shape

The first version has six parts:

  1. Form Trigger
  2. Code node to split keyword input
  3. Split In Batches node
  4. HTTP Request node
  5. Code node to normalize organic results
  6. Storage or output node

The goal is not to build a full research platform. The goal is to make batch SERP collection repeatable.

Step 1: Create a form input

Use an n8n Form Trigger or any form-like input source.

Create a textarea field:

keywords
Enter fullscreen mode Exit fullscreen mode

Example input:

serp api
best serp api
google search api
ai search visibility
Enter fullscreen mode Exit fullscreen mode

Keep one keyword per line. That makes parsing simple and reduces accidental duplicates.

Step 2: Split the keyword list

Add a Code node after the form.

const raw = $json.keywords || "";

const keywords = raw
  .split("\n")
  .map((keyword) => keyword.trim())
  .filter(Boolean);

const seen = new Set();
const uniqueKeywords = [];

for (const keyword of keywords) {
  const key = keyword.toLowerCase();
  if (seen.has(key)) continue;
  seen.add(key);
  uniqueKeywords.push(keyword);
}

return uniqueKeywords.map((keyword) => ({
  json: {
    keyword,
  },
}));
Enter fullscreen mode Exit fullscreen mode

This gives n8n one item per keyword.

Step 3: Add Split In Batches

Add a Split In Batches node.

Start with a small batch size:

1
Enter fullscreen mode Exit fullscreen mode

A batch size of one is slower, but it is easier to debug. Once the workflow is stable, you can adjust the cadence based on your operational needs.

Step 4: Add the HTTP Request node

Use a POST request.

URL:

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.keyword }}
num=10
json=2
Enter fullscreen mode Exit fullscreen mode

This returns structured search data for each keyword. For the first output, focus on the organic field.

Step 5: Normalize the response

Add another Code node after the HTTP Request node.

const keyword = $json.request_params?.q || $json.keyword;
const organic = $json.organic || [];

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

This turns each SERP into rows that can be written to a sheet, database, or CSV-like output.

Step 6: Store the output

For a first version, use Google Sheets or a database node.

Useful columns:

run_id
keyword
position
title
link
description
fetched_at
Enter fullscreen mode Exit fullscreen mode

The run_id matters. Without it, you cannot easily compare one research run with another.

Step 7: Add a lightweight run summary

After all items finish, create a summary:

keywords submitted
unique keywords processed
results saved
failed keywords
run_id
Enter fullscreen mode Exit fullscreen mode

That summary helps you know whether the workflow completed cleanly.

What to improve next

Once the basic batch flow works, the next improvements are straightforward:

  • add a status column for each keyword
  • store raw JSON beside normalized rows
  • extract domains from result URLs
  • group results by domain
  • add People Also Ask questions for intent research
  • compare one run against a previous run

The important thing is to keep batch collection boring and traceable.

A keyword list becomes much more useful when every query produces the same kind of structured output.

If you want to test a small batch workflow with live Google results, TalorData gives new accounts 500 responses to validate the process before scaling it.

Top comments (0)