What you'll have by the end
- A working n8n workflow that checks Google Search Console every morning, compares this week with last week, and posts pages that lost 30%+ of their clicks to Slack.
- The core n8n skills that transfer to any workflow: triggers, items, expressions, HTTP requests with OAuth, the Code node, IF logic, Slack, and error workflows.
- Time needed: about 60 to 90 minutes, most of it spent in Google Cloud Console clicking "Next" (sorry, that part is not n8n's fault).
- Cost: free if you self-host, or the n8n Cloud trial.
Most n8n tutorials teach you to fetch a random joke from an API and send it to yourself. That's fine for learning the buttons. It's not fine for learning how to build something your boss will actually use.
So in this tutorial we'll build a real workflow, the kind I build for SEO teams: an automatic alert when your organic traffic drops. Every morning, n8n pulls page-level data from Google Search Console, compares the last 7 days with the 7 days before, and if any important page lost a big chunk of clicks, it posts a tidy message in Slack. No more discovering a traffic drop three weeks later in a monthly report.
Along the way you'll learn the concepts that make n8n click. And if you're still deciding whether n8n is the right tool at all, read how to choose an automation stack first, or compare it with Make and Zapier.
What is n8n (in 60 seconds)?
n8n (pronounced "n-eight-n", short for "nodemation") is a workflow automation platform. Like Zapier and Make, you connect apps visually. Unlike them, it's source-available and self-hostable, it lets you drop real JavaScript or Python into any workflow, and its pricing counts whole workflow runs (executions), not individual steps.
That combination makes n8n the favorite of technical teams: you get the speed of visual building plus the escape hatch of code whenever you need it. It's also become one of the most popular platforms for building AI agents, with dedicated AI Agent nodes, memory, tools and MCP support.
The 6 concepts you need
- Workflow: the whole automation, drawn on a canvas.
- Node: one step. It can be a trigger, an app action, logic, or code.
- Trigger: the node that starts a workflow (a schedule, a webhook, a new email).
- Items: the data flowing between nodes. A node receives a list of items and usually runs once per item. This is the single most important concept in n8n. If something runs 50 times when you expected once, it's an items thing. It's always an items thing.
- Expressions: little snippets in
{{ double curly braces }}that pull data from previous nodes or compute values, like{{ $json.email }}. - Execution: one full run of a workflow. n8n Cloud plans are priced per execution, no matter how many nodes run inside it.
Before you start: what you need
- An n8n instance: n8n Cloud (free trial) or self-hosted (instructions below).
- A Google Search Console property with some traffic, and a Google account that has access to it.
- A Google Cloud project (free) to create OAuth credentials.
- A Slack workspace where you can install an app.
- Basic comfort with JSON. You don't need to be a developer. If you've ever looked at an API response and thought "ah, curly brackets", you're qualified.
Step 0: Set up n8n (Cloud or self-hosted)
Option A: n8n Cloud
Sign up at n8n.io, start the trial, and you get a hosted instance in a couple of minutes. Easiest path, and you can skip to step 1. Cloud plans start with the Starter plan (2,500 executions a month); our workflow runs once a day, so it uses about 30 executions a month. Practically a rounding error.
Option B: self-host with Docker
If you have Docker installed, this is the official one-liner to run n8n locally:
docker volume create n8n_data
docker run -it --rm --name n8n -p 5678:5678 \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Open http://localhost:5678, create the owner account, and you're in. For production you'd run it on a server with a domain, HTTPS, and a Postgres database (and, if volume grows, queue mode with workers), but local is perfect for this tutorial.
Heads-up for n8n 2.x
Since n8n 2.0 (December 2025), saving a workflow and making it live are separate actions: you save drafts and publish to production. Older tutorials talk about an "Active" toggle; in 2.x you use Publish instead. Also, Code nodes now run in "task runners" for security. The default Docker setup handles this, so you don't need to do anything for this tutorial.
One more thing: open workflow settings and set the timezone to yours. Otherwise "every day at 8 a.m." means 8 a.m. somewhere you're not, and you'll wonder why Slack pings you at 3 a.m.
Step 1: Connect n8n to Google Search Console
This is the fiddliest part of the tutorial, so let's get it out of the way. We need n8n to call the Search Console API on your behalf, which means OAuth.
- Create a Google Cloud project. Go to the Google Cloud Console, create a new project (call it something like "n8n-automations").
- Enable the API. In "APIs & Services" → "Library", search for Google Search Console API and click Enable. If you skip this, you'll later get a 403 error saying the API "has not been used in project... or it is disabled". Ask me how I know.
- Configure the OAuth consent screen. Choose "Internal" if you're on Google Workspace (simplest), otherwise "External" and add yourself as a test user. Fill in app name and email. You don't need to publish it for personal use.
- Create OAuth credentials. "Credentials" → "Create credentials" → "OAuth client ID" → type "Web application".
- Copy the redirect URL from n8n. In n8n, go to Credentials → Add credential → search for Google OAuth2 API. n8n shows an "OAuth Redirect URL". Paste it into the "Authorized redirect URIs" field in Google Cloud, then create the client.
- Finish the credential in n8n. Paste the Client ID and Client Secret from Google into the n8n credential. In Scope, enter:
https://www.googleapis.com/auth/webmasters.readonly. Click "Sign in with Google", approve, and you should see a green "Connected" message.
Why the generic "Google OAuth2 API" credential and not a dedicated node? Because it works with the HTTP Request node for any Google API with the scope you choose. Learn this pattern once and you can talk to Search Console, Google Ads, YouTube Analytics or anything else Google offers. It's the n8n skill with the best return on investment.
Step 2: Add a Schedule Trigger
Create a new workflow and name it "SEO: daily GSC drop alert". Click Add first step and choose Schedule Trigger.
- Trigger Interval: Days
- Days Between Triggers: 1
- Trigger at Hour: 8am
- Trigger at Minute: 0
That's it. When testing, you'll click "Execute workflow" manually, so you don't have to wait until tomorrow morning like an animal.
Step 3: Create a Config node (and do date math)
Add an Edit Fields (Set) node after the trigger and rename it to Config. Putting all settings in one node is a habit that will save you hours: when you want to change the threshold or reuse the workflow for another site, there's exactly one place to look.
Add these fields (use "Add Field", pick the type, and switch values to Expression mode where they contain {{ }}):
| Name | Type | Value |
|---|---|---|
| siteUrl | String | sc-domain:example.com (or https://www.example.com/ for URL-prefix properties) |
| dropThreshold | Number | 0.3 (30% drop) |
| minClicks | Number | 20 (ignore tiny pages) |
| currentStart | String | {{ $now.minus({ days: 9 }).toFormat('yyyy-MM-dd') }} |
| currentEnd | String | {{ $now.minus({ days: 3 }).toFormat('yyyy-MM-dd') }} |
| previousStart | String | {{ $now.minus({ days: 16 }).toFormat('yyyy-MM-dd') }} |
| previousEnd | String | {{ $now.minus({ days: 10 }).toFormat('yyyy-MM-dd') }} |
Why minus 3 days? Search Console data lags by roughly 2 to 3 days. If you compare "the last 7 days including yesterday", the most recent days look like a traffic crash every single morning, and your team will learn to ignore the alert by Wednesday. We compare two complete 7-day windows that end 3 days ago.
$now is a Luxon DateTime object built into n8n, so you can use .minus(), .plus(), .startOf('week') and .toFormat() directly in expressions. Very handy, and much less painful than date math in spreadsheets.
Click Execute step. You should see one item on the right with all seven fields. Check the dates look right.
Step 4: Query Search Console with the HTTP Request node
Add an HTTP Request node after Config and rename it to GSC: this week. Configure it like this:
- Method: POST
- URL (Expression mode):
https://www.googleapis.com/webmasters/v3/sites/{{ encodeURIComponent($('Config').first().json.siteUrl) }}/searchAnalytics/query - Authentication: Predefined Credential Type → Google OAuth2 API → select the credential from step 1.
- Send Body: on, Body Content Type: JSON, Specify Body: Using JSON.
Switch the JSON field to Expression mode and paste:
{
"startDate": "{{ $('Config').first().json.currentStart }}",
"endDate": "{{ $('Config').first().json.currentEnd }}",
"dimensions": ["page"],
"rowLimit": 5000
}
Execute the step. If everything is wired correctly, you'll get one item containing a rows array. Each row looks like this:
{
"keys": ["https://www.example.com/blog/some-article/"],
"clicks": 412,
"impressions": 18630,
"ctr": 0.0221,
"position": 6.4
}
Two things worth understanding here, because they apply everywhere in n8n:
$('Config').first().jsonreads data from a specific earlier node by name. We use it instead of$jsonbecause$jsononly refers to the immediately previous node's data. Once your workflow has more than two steps, referencing nodes by name keeps you sane.encodeURIComponent(): the site URL goes inside the API path, so characters like:and/must be encoded. Expressions in n8n are JavaScript, so standard JS functions just work.
Builder tip: pin your data
Once the request returns real data, click the pin icon on the output panel. n8n will reuse that pinned data in future test runs instead of calling the API every time. Faster testing, no rate limits, and you can tweak later nodes against a stable dataset.
Step 5: Fetch the previous week
Duplicate the HTTP node (select it, Ctrl/Cmd+C, Ctrl/Cmd+V), connect it after "GSC: this week", and rename it to GSC: previous week. Change only the dates in the body:
{
"startDate": "{{ $('Config').first().json.previousStart }}",
"endDate": "{{ $('Config').first().json.previousEnd }}",
"dimensions": ["page"],
"rowLimit": 5000
}
Why chain them instead of running them in parallel? Simplicity. Each HTTP node receives one item and makes one request, and the Code node in the next step can read both outputs by name. Parallel branches with a Merge node also work, but they add a concept you don't need yet.
Step 6: Find the drops with the Code node
Here's where n8n leaves pure no-code tools behind. Add a Code node, rename it to Find drops, set language to JavaScript and mode to Run Once for All Items. Paste this:
// Settings and data from earlier nodes
const cfg = $('Config').first().json;
const current = $('GSC: this week').first().json.rows ?? [];
const previous = $('GSC: previous week').first().json.rows ?? [];
// Index this week's rows by URL for fast lookups
const now = new Map(current.map(r => [r.keys[0], r]));
const drops = [];
for (const before of previous) {
if (before.clicks < cfg.minClicks) continue; // skip small pages
const url = before.keys[0];
const after = now.get(url);
const clicksNow = after ? after.clicks : 0;
const change = (clicksNow - before.clicks) / before.clicks;
if (change <= -cfg.dropThreshold) {
drops.push({
url,
before: before.clicks,
now: clicksNow,
lost: before.clicks - clicksNow,
change,
posBefore: before.position,
posNow: after ? after.position : null,
});
}
}
// Biggest absolute losses first, keep the top 10
drops.sort((a, b) => b.lost - a.lost);
const top = drops.slice(0, 10);
const path = u => u.replace(/^https?:\/\/[^/]+/, '') || '/';
const lines = top.map(d => {
const pct = Math.round(d.change * 100);
const pos = d.posNow
? `pos ${d.posBefore.toFixed(1)} → ${d.posNow.toFixed(1)}`
: 'no longer getting clicks';
return `• <${d.url}|${path(d.url)}>: ${d.before} → ${d.now} clicks (${pct}%), ${pos}`;
});
const totalLost = drops.reduce((sum, d) => sum + d.lost, 0);
return [{
json: {
count: drops.length,
totalLost,
period: `${cfg.currentStart} to ${cfg.currentEnd} vs ${cfg.previousStart} to ${cfg.previousEnd}`,
text:
`:rotating_light: *${drops.length} page(s) lost ${Math.round(cfg.dropThreshold * 100)}%+ of clicks* ` +
`(${totalLost} clicks lost in total)\n_${cfg.currentStart} to ${cfg.currentEnd} vs the week before_\n\n` +
lines.join('\n') +
(drops.length > 10 ? `\n…and ${drops.length - 10} more.` : ''),
},
}];
What this does, in human terms:
- Reads both weeks of data and the settings.
- For every page that had at least 20 clicks last week, checks how many it got this week (zero if it disappeared).
- Keeps pages that dropped by 30% or more.
- Sorts them by clicks lost, so the most expensive drop sits on top.
- Formats a Slack message using Slack's markdown (
*bold*,_italic_, and<url|label>for links). - Returns a single item with
countand the messagetext.
Note the return format: n8n expects an array of objects with a json key. Forgetting the json wrapper is the number one Code node error. Number two is forgetting return altogether and wondering why nothing comes out. Welcome to programming, you're doing great.
Why use code here at all?
You could build this comparison with Merge, Filter and Sort nodes. It would work and it would take about 8 nodes. The Code node does it in one readable block, and it's easy to extend later (for example, to also flag pages whose position dropped by more than 3 spots). This "visual for the plumbing, code for the logic" split is exactly why technical teams pick n8n. More on that trade-off in my article on n8n vs custom code.
Step 7: Only alert when something actually dropped
Add an IF node after the Code node and rename it to Any drops?
- Value 1:
{{ $json.count }} - Operation: Number → is greater than
- Value 2:
0
The IF node has two outputs: true and false. We'll connect Slack to the true output and leave false empty. On quiet days nothing happens, which is exactly what good alerting looks like. An alert that fires every day "just to say all is fine" trains people to mute the channel.
Step 8: Send the alert to Slack
Create a Slack app (5 minutes)
- Go to api.slack.com/apps → Create New App → From scratch. Name it "SEO Alerts" and choose your workspace.
- Under OAuth & Permissions, add the Bot Token Scope
chat:write. Addchannels:readtoo if you want to pick channels from a list in n8n. - Click Install to Workspace, approve, and copy the Bot User OAuth Token (starts with
xoxb-). - In Slack, open the channel for alerts (say
#seo-alerts) and invite the bot: type/invite @SEO Alerts. Forget this and you'll get anot_in_channelerror, which is Slack's polite way of saying "you didn't invite me to the party".
Configure the Slack node
Add a Slack node on the true output of the IF node:
- Credential: create a new Slack API credential with the bot token.
- Resource: Message, Operation: Send
- Send Message To: Channel, then pick
#seo-alerts(or paste its channel ID) - Message Type: Simple Text Message
- Message Text:
{{ $json.text }}
Execute the workflow. If your site had any qualifying drops, you'll see something like this in Slack:
🚨 3 page(s) lost 30%+ of clicks (612 clicks lost in total)
2026-11-10 to 2026-11-16 vs the week before
• /blog/heat-pump-costs/: 488 → 201 clicks (-59%), pos 3.2 → 7.9
• /pricing/: 240 → 131 clicks (-45%), pos 1.4 → 1.6
• /blog/old-guide/: 216 → 0 clicks (-100%), no longer getting clicks
No drops on your site this week? Lucky you. To test the Slack part anyway, temporarily set dropThreshold to 0.01 in Config. Just don't forget to set it back, or the channel will start reading like a horror novel.
Step 9: Add an error workflow (the step everyone skips)
Here's the trap: if the Google token expires or the API errors out, this workflow fails silently. No alert means "no drops", and everyone relaxes while the site quietly bleeds. An alerting system that fails silently is worse than no alerting system.
Fix it in two minutes:
- Create a new workflow called "Error handler".
- Add an Error Trigger node.
- Add a Slack node that posts to
#automation-alertswith a message like:⚠️ Workflow "{{ $json.workflow.name }}" failed: {{ $json.execution.error.message }} {{ $json.execution.url }} - Save it, then go back to the GSC workflow → Settings → Error workflow → choose "Error handler".
One error workflow can watch all your workflows. Set it once and assign it everywhere. It's the single highest-value habit in n8n.
Step 10: Test end to end and publish
- Unpin data on the HTTP nodes so they fetch live data.
- Click Execute workflow and check every node's output: dates in Config, rows in both GSC nodes, the summary in Find drops, the IF result, the Slack message.
- Test the failure path: temporarily break the site URL in Config, run the workflow, and confirm the error message lands in Slack. Then fix it.
- Click Publish (n8n 2.x) to make the schedule live. In n8n 1.x, toggle the workflow to Active.
- Tomorrow at 8 a.m., check Executions to confirm it ran on schedule.
Congratulations. You've built a real monitoring system with an API integration, OAuth, date logic, custom code, conditional routing, notifications and error handling. That's not a toy; that's the same skeleton I use for production systems like the Tech SEO Issue Finder.
Understanding items: the concept that unlocks n8n
We touched on items earlier, but it's worth a proper look, because once items make sense, n8n makes sense.
Every node outputs a list of items. Each item is a JSON object (plus optional binary data like files). When the next node runs, it usually executes once for each item it receives. So if a Google Sheets node outputs 50 rows, a Slack node connected to it will send 50 messages. That's powerful when you want it and alarming when you don't.
In our workflow we deliberately kept everything at one item: Config outputs one item, each HTTP node makes one request and returns one item (with a rows array inside), and the Code node in "Run Once for All Items" mode returns one summary item. That's why we get one Slack message, not hundreds.
Three tools you'll use constantly to control items:
- Split Out: turns an array inside one item into many items (for example, one item per Search Console row). Use it when you want each row processed separately.
- Aggregate: the reverse. Collects many items back into one, so the next node runs once.
- Loop Over Items (Split in Batches): processes items in batches, which is useful for APIs with rate limits.
The quick debugging question whenever something runs the wrong number of times: "How many items did the previous node output?" Look at the item count in the output panel. Nine times out of ten, that's your answer.
Moving to production: a short hosting checklist
Local Docker is perfect for learning. For workflows your team depends on, take the self-hosted setup a few steps further (or use n8n Cloud and skip this section):
- Run it on a server with a domain and HTTPS, so webhooks and OAuth redirects work reliably.
- Use Postgres instead of the default SQLite for anything beyond light use.
- Set an encryption key (
N8N_ENCRYPTION_KEY) and back it up. Your stored credentials are encrypted with it; lose the key and you lose the credentials. - Back up the database and export workflows regularly. Even better, use source control features if your plan includes them.
- Plan for scale: when volume grows, queue mode with Redis and separate worker processes lets n8n run many executions in parallel.
- Pin your version and read release notes before upgrading, especially across major versions like 1.x to 2.x. n8n publishes breaking changes and a migration report for exactly this reason.
- Limit access: put the editor behind SSO or at least strong passwords and 2FA, and don't expose it more widely than necessary.
Troubleshooting: common errors and fixes
| Error | Likely cause | Fix |
|---|---|---|
| 403 "API has not been used in project... or it is disabled" | Search Console API not enabled in the same Google Cloud project as your OAuth client | Enable the API in that project, wait a minute, retry |
| 403 "User does not have sufficient permission" | The Google account you signed in with can't access that property, or wrong siteUrl format | Check access in Search Console; use sc-domain: for domain properties, full URL with trailing slash for URL-prefix |
| 401 / invalid credentials | Missing or wrong scope, or expired token | Scope must be https://www.googleapis.com/auth/webmasters.readonly; reconnect the credential |
No rows in response | No data for that date range (new property, or dates too recent) | Check dates in Config; keep the 3-day lag |
Slack not_in_channel | Bot wasn't invited to the channel | /invite @YourBot in the channel |
Slack missing_scope | Bot token lacks chat:write | Add the scope, reinstall the app, update the token in n8n |
| Code node: "Cannot read properties of undefined" | A node name in $('...') doesn't match exactly | Node names are case-sensitive; copy them exactly |
| Workflow runs at the wrong hour | Workflow timezone not set | Workflow Settings → Timezone |
Level up: 6 ways to extend this workflow
- Add an AI explanation. Insert an AI node (for example a Basic LLM Chain or AI Agent node with your preferred model) after Find drops, and ask it to suggest likely causes based on the URLs and position changes. Keep it as a suggestion, not a diagnosis.
- Log history to Google Sheets. Append each day's drops to a sheet so you can spot pages that keep sliding week after week.
- Monitor multiple sites. Turn Config into a list of sites and let n8n loop over them. The rest of the workflow barely changes, because n8n runs nodes once per item.
- Query-level alerts. Add
"query"to dimensions to see which keywords dropped, not just which pages. - Correlate with Google updates. Keep a small table of known algorithm update dates and mention them in the alert when a drop overlaps one.
- Create a ticket automatically. For drops above a big threshold, open a Jira or Linear ticket with the data attached. This is a mini version of the system described on my Work page.
What this workflow costs to run
This workflow runs once a day, so about 30 executions a month.
- n8n self-hosted: free software; your only cost is the server, and this workflow barely registers on even the smallest one.
- n8n Cloud: fits easily into the Starter plan's 2,500 executions per month, next to many other workflows.
- Google Search Console API: free, within generous quotas.
- Slack: free.
For comparison: building the same thing in Zapier would need a Code step for the comparison logic and multi-step Zaps (a paid plan), and in Make you'd count credits per module and per bundle. For a once-a-day workflow, all three are cheap. The differences show up when you scale to hundreds of workflows and thousands of runs, which is when n8n's per-execution pricing and self-hosting start to really pay off. My Zapier alternatives roundup runs the numbers.
Want this (and 20 more SEO automations) built for your team?
Rank drop alerts, content decay radar, automated audits that open Jira tickets, outreach pipelines. I design and build them on n8n or custom code, with proper error handling and documentation.
Talk about your workflown8n tutorial FAQ
Is n8n free?
The self-hosted Community Edition is free to use for your own internal workflows, with no execution limits from n8n; you pay only for your server. n8n Cloud is a paid hosted service with plans based on monthly executions, starting with the Starter plan.
Do I need to know how to code to use n8n?
No. Most workflows can be built with nodes and simple expressions. Knowing some JavaScript helps a lot, because the Code node and expressions let you handle logic that would otherwise take many nodes. This tutorial's Code node can be copied as-is.
Is n8n better than Zapier?
For technical teams, high volume, custom code, self-hosting and AI agents, n8n is usually the better choice and much cheaper at scale. Zapier is easier for non-technical users and has far more ready-made integrations. See the Zapier review for details.
What is an execution in n8n?
An execution is one complete run of a workflow, from trigger to end. n8n Cloud counts executions regardless of how many nodes run or how much data they process, which makes complex workflows much cheaper than per-step pricing.
How do I connect n8n to Google Search Console?
Enable the Google Search Console API in a Google Cloud project, create an OAuth client ID, and add a Google OAuth2 API credential in n8n with the scope https://www.googleapis.com/auth/webmasters.readonly. Then use the HTTP Request node to call the searchAnalytics/query endpoint.
What changed in n8n 2.0?
n8n 2.0, released in December 2025, introduced separate save and publish actions so editing a workflow doesn't change production immediately, made task runners the default for running Code nodes securely, and included various security and performance changes. Check the official breaking changes page before upgrading self-hosted instances.
Can n8n build AI agents?
Yes. n8n has dedicated AI nodes, including an AI Agent node that can use tools, memory and MCP servers, plus integrations with major model providers. It's one of the most popular platforms for building production AI agents with real business integrations.
Wrapping up
You just learned the n8n essentials by building something useful: triggers, expressions, OAuth-authenticated API calls, the items model, custom code, conditional logic, notifications and error handling. Every serious n8n workflow is a remix of those pieces.
Next step: pick one manual check your team does every week and automate it using the same skeleton. Then add the error workflow (seriously, add the error workflow). Once you've done it twice, you'll start seeing automation opportunities everywhere, which is both a superpower and a mild curse.