The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "1GvJhbtNl7rXsnXe",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "SEO key word analysis and filter",
"tags": [
{
"id": "tKXLKPMBHBBgoCJM",
"name": "SEO",
"createdAt": "2025-03-08T12:14:40.598Z",
"updatedAt": "2025-03-08T12:14:40.598Z"
}
],
"nodes": [
{
"id": "632cc5fb-701e-4c1a-9e94-8261b73b81e4",
"name": "When clicking \u2018Test workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-600,
-280
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f4bfb60a-b43d-496e-9ac4-4d33dce8d0b7",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1240,
-380
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "51ea2c40-2ec5-489e-99c9-c5421e3c11eb",
"name": "get the rule data",
"type": "n8n-nodes-base.googleDrive",
"position": [
-340,
-540
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "list",
"value": "1mTF6w3xOy6TSx5__3b0i9ETFWJ1PyT9l",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mTF6w3xOy6TSx5__3b0i9ETFWJ1PyT9l/edit?usp=drivesdk&ouid=117136+1234567890&rtpof=true&sd=true",
"cachedResultName": "filter_rules.xlsx"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "0adead9c-170f-4174-a8de-e76d9dfc2fc8",
"name": "transform the data",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-160,
-540
],
"parameters": {
"options": {},
"operation": "rtf"
},
"typeVersion": 1
},
{
"id": "18accb1e-c896-4d4b-933e-884302c07abe",
"name": "data processing",
"type": "n8n-nodes-base.aggregate",
"position": [
60,
-540
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "brand"
},
{
"fieldToAggregate": "fabric"
},
{
"fieldToAggregate": "size"
},
{
"fieldToAggregate": "design"
},
{
"fieldToAggregate": "location"
},
{
"fieldToAggregate": "demographic"
},
{
"renameField": true,
"outputFieldName": "holiday",
"fieldToAggregate": "[\"holiday [Halloween costume ideas]\"]"
},
{
"fieldToAggregate": "scenario"
}
]
}
},
"typeVersion": 1
},
{
"id": "287205c8-64d4-4c4e-9af9-31775a6306c0",
"name": "add a merge field",
"type": "n8n-nodes-base.set",
"position": [
260,
-540
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "38e2ba87-5e63-45fa-895e-b6b1d2990b71",
"name": "brand",
"type": "array",
"value": "={{ $json.brand }}"
},
{
"id": "35084dd4-68f4-4627-a0f5-b549b85af78c",
"name": "fabric",
"type": "array",
"value": "={{ $json.fabric }}"
},
{
"id": "8bcab448-c3cb-4ad4-a807-3f4d48f091a8",
"name": "size",
"type": "array",
"value": "={{ $json.size }}"
},
{
"id": "7fca3332-bc9d-46d3-985f-2fff8748c1fd",
"name": "design",
"type": "array",
"value": "={{ $json.design }}"
},
{
"id": "ec88e4ad-0f18-4264-8922-f0df9243e2df",
"name": "scenario",
"type": "array",
"value": "={{ $json.scenario }}"
},
{
"id": "6dfc3ea0-fe54-4a92-8410-da0260f6ab93",
"name": "holiday",
"type": "array",
"value": "={{ $json.holiday }}"
},
{
"id": "1b1f6069-6f93-48d3-a813-6b500173185d",
"name": "demographic",
"type": "array",
"value": "={{ $json.demographic }}"
},
{
"id": "c2fdb3bb-0d85-4aab-82c8-dc0c124bf21b",
"name": "location",
"type": "array",
"value": "={{ $json.location }}"
},
{
"id": "aff6273c-5c08-4628-907a-4e5fd663d7a4",
"name": "merge",
"type": "string",
"value": "1"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "276e5820-4ef2-4279-bf6f-44a4fb637393",
"name": "get the keyword data",
"type": "n8n-nodes-base.googleDrive",
"position": [
-360,
80
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "list",
"value": "13gyrNpN4SeV_mXI5e7duQ97JCfzNDUIESRRBInBqXL0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/13gyrNpN4SeV_mXI5e7duQ97JCfzNDUIESRRBInBqXL0/edit?usp=drivesdk",
"cachedResultName": "sleeveless-dress_broad-match_us_2025-03-08"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "009a11b4-f56c-4e79-8026-824117f2cd12",
"name": "transform the data1",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-140,
80
],
"parameters": {
"options": {},
"operation": "rtf"
},
"typeVersion": 1
},
{
"id": "2b9630eb-00f2-4775-bde5-b8a80ded2134",
"name": "filter by volume and kd",
"type": "n8n-nodes-base.if",
"position": [
80,
80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "45e9ea99-70d2-4aba-8a90-d57a4140718d",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.Volume }}",
"rightValue": 100
},
{
"id": "ed85b217-6b2d-4f0e-aa77-1f91cab0447f",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json.Volume }}",
"rightValue": 10000
},
{
"id": "63e5d8e2-1a32-44f1-8511-41e8fa9e0cb3",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json[\"Keyword Difficulty\"] }}",
"rightValue": 30
}
]
}
},
"typeVersion": 2.2
},
{
"id": "7505be5a-0af9-449f-b6b8-53629619d849",
"name": "add the merge field",
"type": "n8n-nodes-base.set",
"position": [
340,
40
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e3974b8e-bde4-4a00-b3bf-b494b865059e",
"name": "Keyword",
"type": "string",
"value": "={{ $json.Keyword }}"
},
{
"id": "bcb4e3bf-38dc-4d04-b637-b044fbe08ce1",
"name": "merge",
"type": "string",
"value": "1"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1d254381-de41-4ba8-b9ad-c372cd9e56d9",
"name": "Merge rule and keyword",
"type": "n8n-nodes-base.merge",
"position": [
540,
-280
],
"parameters": {
"mode": "combine",
"options": {},
"fieldsToMatchString": "merge"
},
"typeVersion": 3
},
{
"id": "7c2f23b5-97ee-4a37-8c77-5458277fd43e",
"name": "filter the keyword by normal rule",
"type": "n8n-nodes-base.code",
"position": [
780,
-280
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Add a new field called 'myNewField' to the JSON of the item\nfunction buildPattern(word) {\n return word\n .toLowerCase()\n .trim()\n // \u5904\u7406\u8fde\u5b57\u7b26\u548c\u7a7a\u683c\u53d8\u4f53\uff1aoff-the-shoulder -> off[-\\s]?the[-\\s]?shoulder\n .replace(/[- ]/g, '[\\\\s-]?') \n // \u8f6c\u4e49\u7279\u6b8a\u5b57\u7b26\n .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nconst rulesOrder = [\n 'brand', \n 'demographic',\n 'fabric', \n 'design',\n 'holiday',\n 'scenario',\n 'size',\n 'location' \n ];\nconst keyword = $input.item.json.Keyword.toLowerCase();\nlet matchedRule = '';\nfor (const ruleType of rulesOrder) {\n const words = $input.item.json[ruleType] || [];\n if (words.length === 0) continue;\n\n // \u6784\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\n const patterns = words.map(word => \n `\\\\b${buildPattern(word)}\\\\b` // \u5355\u8bcd\u8fb9\u754c\u5339\u914d\n );\n \n const regex = new RegExp(patterns.join('|'), 'i');\n if (regex.test(keyword)) {\n matchedRule = ruleType;\n break; // \u53d1\u73b0\u8fdd\u89c4\u7acb\u5373\u7ec8\u6b62\n }\n }\n\n return {\n Keyword: keyword,\n filter_rule: matchedRule\n };"
},
"typeVersion": 2
},
{
"id": "458b5eef-b946-4193-8ced-ecf3a8ef5a72",
"name": "filter the data for deep rule",
"type": "n8n-nodes-base.if",
"position": [
1000,
-280
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "15febc26-52be-4d49-9344-2d59b1b689cd",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.filter_rule }}",
"rightValue": "\"\""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "1ed66595-f883-45db-87c6-5cb0685fa146",
"name": "AI Classifier",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
1240,
-640
],
"parameters": {
"options": {
"enableAutoFixing": true
},
"inputText": "={{ $json.Keyword }}",
"categories": {
"categories": [
{
"category": "filter_by_colour",
"description": "This keyword contains color descriptors outside the permitted white/black spectrum (e.g., red, blue)"
},
{
"category": "filter_by_name",
"description": "this type means that the keyword contain some names of people"
}
]
}
},
"typeVersion": 1
},
{
"id": "57f53de9-1d4a-4e6b-b45e-c8da0d2a547c",
"name": "Code fix the AI analysis",
"type": "n8n-nodes-base.code",
"position": [
1740,
-660
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Add a new field called 'myNewField' to the JSON of the item\n// $input.item.json.myNewField = 1;\n\nconst keyword = $input.item.json.Keyword.toLowerCase();\n\nconst hasAllowedColor = /\\b(black|white)\\b/.test(keyword);\n\nreturn {\n \"Keyword\":keyword,\n \"filter_rule\": hasAllowedColor ? \"normal\" : \"filter_by_colour\"\n };\n"
},
"typeVersion": 2
},
{
"id": "698a8af5-ccb1-4ae6-95b4-3f725946d198",
"name": "Filter the right data",
"type": "n8n-nodes-base.filter",
"position": [
1860,
-400
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0defca0e-1ea9-4c78-9bc9-c77c83097943",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.filter_rule }}",
"rightValue": "filter_by_colour"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "fe9b7a6d-cf8b-4bc0-8d8b-ea697665f8e3",
"name": "data formatting",
"type": "n8n-nodes-base.set",
"position": [
1540,
-380
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "29d883b8-c6d1-4a03-80e3-69826c699164",
"name": "Keyword",
"type": "string",
"value": "={{ $json.Keyword }}"
},
{
"id": "88ea0ca1-2541-4cf6-8b62-35f1613a8a21",
"name": "filter_rule",
"type": "string",
"value": "\u201cfilter_by_name\u201d"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "59db7bdd-96c7-4ab6-a868-87dabfa36d8e",
"name": "Merge the filter catagory",
"type": "n8n-nodes-base.merge",
"position": [
1880,
-20
],
"parameters": {
"numberInputs": 4
},
"typeVersion": 3
},
{
"id": "fd29ac5c-5d27-4799-9ed4-fc4aa0ae3415",
"name": "Merge with initial data",
"type": "n8n-nodes-base.merge",
"position": [
1940,
360
],
"parameters": {
"mode": "combine",
"options": {},
"joinMode": "enrichInput2",
"fieldsToMatchString": "Keyword"
},
"typeVersion": 3
},
{
"id": "d5b9cb93-9cb3-472d-8648-a380a0f52496",
"name": "output the results",
"type": "n8n-nodes-base.googleSheets",
"position": [
2220,
320
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "Keyword",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Keyword",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Intent",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Intent",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Volume",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Volume",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Trend",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Trend",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Keyword Difficulty",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Keyword Difficulty",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "CPC (USD)",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "CPC (USD)",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Competitive Density",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Competitive Density",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "SERP Features",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "SERP Features",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Number of Results",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Number of Results",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "filter_rule",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "filter_rule",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1519232161,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/13gyrNpN4SeV_mXI5e7duQ97JCfzNDUIESRRBInBqXL0/edit#gid=1519232161",
"cachedResultName": "analysis_result"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "13gyrNpN4SeV_mXI5e7duQ97JCfzNDUIESRRBInBqXL0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/13gyrNpN4SeV_mXI5e7duQ97JCfzNDUIESRRBInBqXL0/edit?usp=drivesdk",
"cachedResultName": "sleeveless-dress_broad-match_us_2025-03-08"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.5
},
{
"id": "0ff7f7ff-58e8-4803-8968-c21f016cae56",
"name": "data processing2",
"type": "n8n-nodes-base.set",
"position": [
1400,
260
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "29d883b8-c6d1-4a03-80e3-69826c699164",
"name": "Keyword",
"type": "string",
"value": "={{ $json.Keyword }}"
},
{
"id": "88ea0ca1-2541-4cf6-8b62-35f1613a8a21",
"name": "filter_rule",
"type": "string",
"value": "\u201cfilter_by_volume_and_kd\u201d"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "496cf3f5-e13e-4c40-8557-2b78b619c19b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
-740
],
"parameters": {
"color": 4,
"width": 900,
"height": 360,
"content": "# 1.Establishing Core Filtering Criteria\n## in my scenario,this workflow is working for a clothes company\n## we define a couple of rules like brand,fabric,size,design,location\n## this part is easy rules that we could implement by words comparisons\n"
},
"typeVersion": 1
},
{
"id": "74fff5a7-0577-44ec-a6d7-22611a8feb6e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-420,
-120
],
"parameters": {
"width": 880,
"height": 380,
"content": "# 2.Get the Data Through Semrush\n## semrush is a data provider where you could get some detail data \n## you could replace this part with api if you got a apikey (it's expensive)"
},
"typeVersion": 1
},
{
"id": "e823f82b-7d03-4d3e-9d21-d7c58d75003b",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
500,
-500
],
"parameters": {
"color": 3,
"width": 620,
"height": 440,
"content": "# 3.Basic Filter Implementation"
},
"typeVersion": 1
},
{
"id": "92d4d47f-5d2b-44b1-acd3-003bde0eb414",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1180,
-880
],
"parameters": {
"width": 960,
"height": 660,
"content": "# 4.Advanced AI Processing Layer\n## use AI to classify the keyword that contain colour and names "
},
"typeVersion": 1
},
{
"id": "24fca9c4-4602-4932-81d2-ab91a4c87cd1",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1380,
-120
],
"parameters": {
"width": 1040,
"height": 640,
"content": "# 5.Data Consolidation & Output"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "25343a99-0d5b-408f-9d0f-81026bd54a81",
"connections": {
"AI Classifier": {
"main": [
[
{
"node": "Code fix the AI analysis",
"type": "main",
"index": 0
}
],
[
{
"node": "data formatting",
"type": "main",
"index": 0
}
]
]
},
"data formatting": {
"main": [
[
{
"node": "Merge the filter catagory",
"type": "main",
"index": 1
}
]
]
},
"data processing": {
"main": [
[
{
"node": "add a merge field",
"type": "main",
"index": 0
}
]
]
},
"data processing2": {
"main": [
[
{
"node": "Merge the filter catagory",
"type": "main",
"index": 3
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"add a merge field": {
"main": [
[
{
"node": "Merge rule and keyword",
"type": "main",
"index": 0
}
]
]
},
"get the rule data": {
"main": [
[
{
"node": "transform the data",
"type": "main",
"index": 0
}
]
]
},
"transform the data": {
"main": [
[
{
"node": "data processing",
"type": "main",
"index": 0
}
]
]
},
"add the merge field": {
"main": [
[
{
"node": "Merge rule and keyword",
"type": "main",
"index": 1
}
]
]
},
"transform the data1": {
"main": [
[
{
"node": "filter by volume and kd",
"type": "main",
"index": 0
},
{
"node": "Merge with initial data",
"type": "main",
"index": 1
}
]
]
},
"get the keyword data": {
"main": [
[
{
"node": "transform the data1",
"type": "main",
"index": 0
}
]
]
},
"Filter the right data": {
"main": [
[
{
"node": "Merge the filter catagory",
"type": "main",
"index": 0
}
]
]
},
"Merge rule and keyword": {
"main": [
[
{
"node": "filter the keyword by normal rule",
"type": "main",
"index": 0
}
]
]
},
"Merge with initial data": {
"main": [
[
{
"node": "output the results",
"type": "main",
"index": 0
}
]
]
},
"filter by volume and kd": {
"main": [
[
{
"node": "add the merge field",
"type": "main",
"index": 0
}
],
[
{
"node": "data processing2",
"type": "main",
"index": 0
}
]
]
},
"Code fix the AI analysis": {
"main": [
[
{
"node": "Filter the right data",
"type": "main",
"index": 0
}
]
]
},
"Merge the filter catagory": {
"main": [
[
{
"node": "Merge with initial data",
"type": "main",
"index": 0
}
]
]
},
"filter the data for deep rule": {
"main": [
[
{
"node": "Merge the filter catagory",
"type": "main",
"index": 2
}
],
[
{
"node": "AI Classifier",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Test workflow\u2019": {
"main": [
[
{
"node": "get the keyword data",
"type": "main",
"index": 0
},
{
"node": "get the rule data",
"type": "main",
"index": 0
}
]
]
},
"filter the keyword by normal rule": {
"main": [
[
{
"node": "filter the data for deep rule",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleDriveOAuth2ApigoogleSheetsOAuth2ApiopenAiApi
About this workflow
SEO key word analysis and filter. Uses manualTrigger, lmChatOpenAi, googleDrive, extractFromFile. Event-driven trigger; 26 nodes.
Source: https://github.com/ScraperNode/awesome-n8n-templates/blob/main/templates/ai-and-llm/3108-seo-keyword-analysis-and-filter/workflow.json — original creator credit. Request a take-down →