使用GPT-4洞察和Slack交付自动化每周SEO报告
高级
这是一个Market Research, AI Summarization领域的自动化工作流,包含 42 个节点。主要使用 Set, Code, Merge, Slack, SplitOut 等节点。 通过GPT-4洞察和Slack交付自动化每周SEO报告
前置要求
- •Slack Bot Token 或 Webhook URL
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"name": "使用GPT-4洞察和Slack交付自动化每周SEO报告",
"nodes": [
{
"id": "43d47434-1125-439d-ba6a-cab092db3f46",
"name": "配置",
"type": "n8n-nodes-base.set",
"position": [
-1380,
520
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "9941e108-1e6c-4050-8401-9e6125a847de",
"name": "site_url",
"type": "string",
"value": "sc-domain:your-domain.com"
},
{
"id": "06978aeb-e021-4b59-8a42-4225857d7778",
"name": "date_start",
"type": "string",
"value": "={{ $now.minus(1,'month').format('yyyy-LL-dd') }}"
},
{
"id": "780c04e5-5e2d-4a0c-9629-8d7ea7a4be8c",
"name": "date_end",
"type": "string",
"value": "={{ $now.format('yyyy-LL-dd') }}"
},
{
"id": "66e78b2a-965e-4e44-a88b-d31338175fe2",
"name": "date_prev_month_start",
"type": "string",
"value": "={{ $now.minus(2,'month').minus(1,'day').format('yyyy-LL-dd') }}"
},
{
"id": "332eae7c-0318-4cdc-a924-0f5b1ed22dbf",
"name": "date_prev_month_end",
"type": "string",
"value": "={{ $now.minus(1,'month').minus(1,'day').format('yyyy-LL-dd') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "448882ac-8fe0-45fb-b86f-7d019f9268ac",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2120,
420
],
"parameters": {
"width": 420,
"height": 560,
"content": "# 欢迎使用每周SEO报告工作流!"
},
"typeVersion": 1
},
{
"id": "319de69b-177d-4d42-b4cb-3e35ba5e80dc",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1440,
420
],
"parameters": {
"color": 4,
"width": 220,
"height": 320,
"content": "**在此配置:**"
},
"typeVersion": 1
},
{
"id": "0b8f7ebe-4629-405a-84ff-0dcf9334f272",
"name": "Pdforge",
"type": "n8n-nodes-pdforge.pdforge",
"position": [
600,
520
],
"parameters": {
"options": {},
"variables": "={{ JSON.stringify($json) }}",
"templateId": "template_seo_report"
},
"credentials": {
"pdforgeApi": {
"id": "fFuvCIsBkIHHd0ct",
"name": "Pdforge account"
}
},
"typeVersion": 1
},
{
"id": "c744768d-3ffc-4ec8-8526-62992e9cdea0",
"name": "下载二进制文件",
"type": "n8n-nodes-base.httpRequest",
"position": [
820,
520
],
"parameters": {
"url": "={{ $json.signedUrl }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "1f0baeea-eb35-4dff-b9c4-1b4a95b53121",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-40,
700
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "3hJLI2ahkB4Zjnwd",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "41fa4fa0-72a7-4402-b1ae-73615d55b3ec",
"name": "生成变量",
"type": "n8n-nodes-base.code",
"position": [
380,
520
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const base = $(\"Format data\").first().json\n\nreturn {\n ...base, \n insights_content: $json.output,\n };\n"
},
"typeVersion": 2
},
{
"id": "639a05bc-e87f-4d1b-afb7-d95a3926676c",
"name": "Slack - 发送带文件的消息",
"type": "n8n-nodes-base.slack",
"position": [
1040,
520
],
"webhookId": "12b44f56-30b4-4278-ad22-32bcb952006e",
"parameters": {
"options": {
"fileName": "=SEO Report - {{ $('Generate variables').first().json.report_date }}",
"channelId": "C093723CAN6",
"initialComment": "📊 *Here's your Weekly SEO Report*"
},
"resource": "file",
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "ombwJbyognfRtMoj",
"name": "Slack account"
}
},
"typeVersion": 2.3
},
{
"id": "16032072-de5c-40c5-b8c3-52c6575e1157",
"name": "每周一上午8点",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1600,
520
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
1
],
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "94ab0f9b-2c78-4e41-8388-2c707b4965ca",
"name": "HTTP请求 - Google Search Console - 查询 - 上个月",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
1120
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_prev_month_start }}\",\n \"endDate\": \"{{ $json.date_prev_month_end }}\",\n \"dimensions\": [\"query\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "ef74bcb0-c187-4135-ac30-fe6ec31723bf",
"name": "HTTP请求 - Google Search Console - 页面 - 上个月",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
1320
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_prev_month_start }}\",\n \"endDate\": \"{{ $json.date_prev_month_end }}\",\n \"dimensions\": [\"page\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "58b0abf2-d9f7-41bc-b6cb-c4c57b60e6d2",
"name": "拆分页面 - 上个月",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
1320
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "0c7e046b-6a6c-4465-b265-c353f40fc7e0",
"name": "格式化查询 - 上个月",
"type": "n8n-nodes-base.set",
"position": [
-660,
1120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bcec450e-ca15-42e9-9644-b4e8c49d8ffb",
"name": "query",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "72775f4f-742e-4597-bf75-971d1d280285",
"name": "HTTP请求 - Google Search Console - 日期",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
-80
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_start }}\",\n \"endDate\": \"{{ $json.date_end }}\",\n \"dimensions\": [\"date\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "c5be25f2-011b-4680-ab57-aab7f2ef96f7",
"name": "拆分日期",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
-80
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "ce7e232a-47dc-4844-b603-de92e3b2b624",
"name": "格式化日期",
"type": "n8n-nodes-base.set",
"position": [
-660,
-80
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d94b7a08-4e03-4f4d-8f8c-9200632305a5",
"name": "date",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "26335560-27b4-4d61-ae22-52a2932bb2c8",
"name": "HTTP请求 - Google Search Console - 概览",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
-280
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_start }}\",\n \"endDate\": \"{{ $json.date_end }}\",\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "f6f9d96e-6db8-4626-b717-cd9b020b98a8",
"name": "拆分概览",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
-280
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "ab057902-8e4c-4beb-bc00-13fcd3d4d0ce",
"name": "格式化概览",
"type": "n8n-nodes-base.set",
"position": [
-660,
-280
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "61e0c8ee-f857-4089-ad25-85b3d9a5d44e",
"name": "HTTP请求 - Google Search Console - 页面",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
320
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_start }}\",\n \"endDate\": \"{{ $json.date_end }}\",\n \"dimensions\": [\"page\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "73834d1c-19a3-4161-892c-7bd3615b41e9",
"name": "拆分页面",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
320
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "945371f9-5929-415b-990b-3074653c0c17",
"name": "HTTP请求 - Google Search Console - 设备",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
520
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_start }}\",\n \"endDate\": \"{{ $json.date_end }}\",\n \"dimensions\": [\"device\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "99d8bd82-b42f-4251-9ab2-1da57af41bf1",
"name": "拆分设备",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
520
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "6774bd8f-e3f7-4bde-a59f-da4caff3b4d2",
"name": "格式化设备",
"type": "n8n-nodes-base.set",
"position": [
-660,
520
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d94b7a08-4e03-4f4d-8f8c-9200632305a5",
"name": "device",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7222f304-0e37-4583-ad6c-53a0ef021833",
"name": "HTTP请求 - Google Search Console - 国家",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
720
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_start }}\",\n \"endDate\": \"{{ $json.date_end }}\",\n \"dimensions\": [\"country\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "316674b1-8bc4-413f-8011-a70f12578dde",
"name": "拆分国家",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
720
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "2fc1ba15-52d7-4eb3-92b2-dc68a2d44e27",
"name": "格式化国家",
"type": "n8n-nodes-base.set",
"position": [
-660,
720
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d94b7a08-4e03-4f4d-8f8c-9200632305a5",
"name": "country",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "46bfc8e3-f7ee-43bc-a397-35760f2bdee7",
"name": "HTTP请求 - Google Search Console - 查询",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
120
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_start }}\",\n \"endDate\": \"{{ $json.date_end }}\",\n \"dimensions\": [\"query\"],\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "13fca08f-2bc8-41ac-af85-568b68ff2767",
"name": "拆分查询",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
120
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "0959323a-313d-4da9-85f1-3af769dcfd00",
"name": "格式化查询",
"type": "n8n-nodes-base.set",
"position": [
-660,
120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bcec450e-ca15-42e9-9644-b4e8c49d8ffb",
"name": "query",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b46adb8d-2ecb-42b4-9497-7dac642ec733",
"name": "格式化页面 - 上个月",
"type": "n8n-nodes-base.set",
"position": [
-660,
1320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bcec450e-ca15-42e9-9644-b4e8c49d8ffb",
"name": "page",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "baf8ea63-023b-4df5-8327-93fcae96a77c",
"name": "格式化页面",
"type": "n8n-nodes-base.set",
"position": [
-660,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bcec450e-ca15-42e9-9644-b4e8c49d8ffb",
"name": "page",
"type": "string",
"value": "={{ $json.keys[0] }}"
},
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ed5e27a0-c217-4fe6-8267-b732eb3dbe09",
"name": "HTTP请求 - Google Search Console - 概览 - 上个月",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1100,
920
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites/{{ $json.site_url }}/searchAnalytics/query",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startDate\": \"{{ $json.date_prev_month_start }}\",\n \"endDate\": \"{{ $json.date_prev_month_end }}\",\n \"rowLimit\": 25000\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "e4c320dd-ab02-48d5-af80-0bc1e918366d",
"name": "拆分查询 - 上个月",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
1120
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "2fcfa4eb-2b42-4d34-a393-2710f9ab634d",
"name": "拆分概览 - 上个月",
"type": "n8n-nodes-base.splitOut",
"position": [
-880,
920
],
"parameters": {
"options": {},
"fieldToSplitOut": "rows"
},
"typeVersion": 1
},
{
"id": "ec6c8668-bf12-4aa0-9c3c-9a3c8975f996",
"name": "格式化概览 - 上个月",
"type": "n8n-nodes-base.set",
"position": [
-660,
920
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5db89e4b-3694-4471-b43a-2a45862c61cc",
"name": "clicks",
"type": "string",
"value": "={{ $json.clicks }}"
},
{
"id": "fba7ee18-7d4e-4ad7-bb0d-aa651eea9490",
"name": "impressions",
"type": "string",
"value": "={{ $json.impressions }}"
},
{
"id": "6a1b6b46-464e-4fd0-9faa-abfec6d9729c",
"name": "ctr",
"type": "string",
"value": "={{ $json.ctr }}"
},
{
"id": "7770d1e7-d892-4598-9a20-c5fef76adcf4",
"name": "position",
"type": "string",
"value": "={{ $json.position }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1eee216f-b8cb-43d6-913a-1fcecf7bd785",
"name": "格式化数据",
"type": "n8n-nodes-base.code",
"position": [
-220,
520
],
"parameters": {
"jsCode": "// Pull each dataset using .all()\nconst overview = $('Format Overview').all()[0].json;\nconst dateData = $('Format Date').all().map(item => item.json);\nconst pageData = $('Format Page').all().map(item => item.json);\nconst queryData = $('Format Query').all().map(item => item.json);\nconst deviceData = $(\"Format Devices\").all().map(item => item.json);\nconst countryData = $('Format Country').all().map(item => item.json);\nconst overviewPrev = $('Format Overview - Previous month').all()[0].json;\nconst queryPrevData = $('Format Query - Previous month').all().map(item => item.json);\nconst pagePrevData = $('Format Page - Previous month').all().map(item => item.json);\n\n\n// // Helper for subtitles\nfunction pctSubtitle(curr, prev) {\n const diff = curr - prev;\n const arrow = diff >= 0 ? '↗' : '↘';\n const col = diff >= 0 ? 'green' : 'red';\n const pct = prev === 0 ? 'N/A' : Math.abs(diff / prev * 100).toFixed(1) + '%';\n return `<p style='color:${col}'>${arrow} ${pct} vs last month</p>`;\n}\nfunction numSubtitle(curr, prev) {\n const diff = curr - prev;\n const arrow = diff >= 0 ? '↗' : '↘';\n const col = diff >= 0 ? 'green' : 'red';\n return `<p style='color:${col}'>${arrow} ${Math.abs(diff)} vs last month</p>`;\n}\n\n// helper to remove protocol+domain, leaving only the path\nfunction stripPath(url) {\n return url.replace(/^https?:\\/\\/[^/]+/, '');\n}\n\n// just above your report definition, build a Set of previous-month queries:\nconst prevQueries = new Set(queryPrevData.map(q => q.query));\n\n// Build the output\nconst report = {\n report_date: `${dateData[0].date} to ${dateData[dateData.length - 1].date}`,\n overview: {\n impressions: {\n value: overview.impressions,\n subtitle: pctSubtitle(overview.impressions, overviewPrev.impressions),\n },\n clicks: {\n value: overview.clicks,\n subtitle: pctSubtitle(overview.clicks, overviewPrev.clicks),\n },\n average_ctr: {\n value: (parseFloat(overview.ctr)*100).toFixed(2)+\"%\",\n subtitle: pctSubtitle(overview.ctr, overviewPrev.ctr),\n },\n average_position: {\n value: parseFloat(overview.position).toFixed(1),\n subtitle: pctSubtitle(overview.position, overviewPrev.position),\n },\n },\n performance: {\n impressions: dateData.map(d => d.impressions),\n clicks: dateData.map(d => d.clicks),\n labels: dateData.map(d => d.date),\n },\n top_10_countries: {\n clicks: countryData.sort((a, b) => b.clicks - a.clicks).slice(0,10).map(d => parseInt(d.clicks)),\n labels: countryData.sort((a, b) => b.clicks - a.clicks).slice(0,10).map(d => d.country),\n },\n devices: {\n clicks: deviceData.sort((a, b) => b.clicks - a.clicks).slice(0,10).map(d => parseInt(d.clicks)),\n labels: deviceData.sort((a, b) => b.clicks - a.clicks).slice(0,10).map(d => d.device),\n },\n organic_keywords_ranking: {\n top_3: {\n value: queryData.filter(q => q.position <= 3).length,\n subtitle: numSubtitle(\n queryData.filter(q => q.position <= 3).length,\n queryPrevData.filter(q => q.position <= 3).length\n ),\n },\n from_3_10: {\n value: queryData.filter(q => q.position >= 4 && q.position <= 10).length,\n subtitle: numSubtitle(\n queryData.filter(q => q.position >= 4 && q.position <= 10).length,\n queryPrevData.filter(q => q.position >= 4 && q.position <= 10).length\n ),\n },\n from_11_20: {\n value: queryData.filter(q => q.position >= 11 && q.position <= 20).length,\n subtitle: numSubtitle(\n queryData.filter(q => q.position >= 11 && q.position <= 20).length,\n queryPrevData.filter(q => q.position >= 11 && q.position <= 20).length\n ),\n },\n from_21_100: {\n value: queryData.filter(q => q.position >= 21).length,\n subtitle: numSubtitle(\n queryData.filter(q => q.position >= 21).length,\n queryPrevData.filter(q => q.position >= 21).length\n ),\n },\n },\n top_5_pages: pageData\n .sort((a, b) => b.clicks - a.clicks)\n .slice(0,5)\n .map(d => ({\n page: `<p style='max-width:200px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis'><strong>${stripPath(d.page)}</strong></p>`,\n clicks: d.clicks,\n impressions: d.impressions,\n ctr: (parseFloat(d.ctr)*100).toFixed(2)+\"%\",\n position: parseFloat(d.position).toFixed(1),\n })),\n top_5_keywords: queryData\n .sort((a, b) => b.clicks - a.clicks)\n .slice(0,5)\n .map(d => ({\n keyword: `<p style='max-width:180px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis'><strong>${d.query}</strong></p>`,\n clicks: d.clicks,\n impressions: d.impressions,\n ctr: (parseFloat(d.ctr)*100).toFixed(2)+\"%\",\n position: parseFloat(d.position).toFixed(1),\n })),\n pages_who_lost_most_traffic_vs_last_month:pagePrevData\n .map(prev => {\n const curr = pageData.find(d => d.page === prev.page) || { clicks: 0 };\n const delta = prev.clicks - curr.clicks; // positive = clicks lost\n return {\n page: prev.page,\n clicks: curr.clicks,\n clicks_last_month: prev.clicks,\n delta\n };\n })\n .sort((a, b) => b.delta - a.delta) // highest drops first\n .slice(0, 5)\n .map(({ page, clicks, clicks_last_month, delta }) => ({\n page: `<p style='max-width:200px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis'><strong>${stripPath(page)}</strong></p>`, // removes protocol+domain\n clicks,\n clicks_last_month,\n delta:\"-\"+delta\n })),\n top_5_new_keywords_last_month: queryData\n // keep only queries not present last month\n .filter(d => !prevQueries.has(d.query))\n // sort by clicks descending\n .sort((a, b) => b.clicks - a.clicks)\n // take top 5\n .slice(0, 5)\n // format exactly like your other lists\n .map(d => ({\n keyword: `<p style='max-width:180px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis'><strong>${d.query}</strong></p>`,\n clicks: d.clicks,\n impressions:d.impressions,\n ctr: (parseFloat(d.ctr)*100).toFixed(2) + \"%\",\n position: parseFloat(d.position).toFixed(1),\n }))\n};\nreturn [{ json: report }];"
},
"executeOnce": false,
"typeVersion": 2
},
{
"id": "beac970b-49f9-4a23-9a46-5aeb8e062f87",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
-440,
400
],
"parameters": {
"numberInputs": 9
},
"typeVersion": 3.2
},
{
"id": "c3190924-430d-4950-a715-fb577d4a0ee6",
"name": "为SEO结果生成洞察",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
0,
520
],
"parameters": {
"text": "={{ JSON.stringify($json) }}",
"options": {
"systemMessage": "=## Persona\nYou are a data-driven Search Console Insights Agent: concise, analytical, and focused on turning raw organic traffic metrics into clear, actionable narrative insights.\n\n## Objective\n- Ingest structured Search Console data (overview, by date, by page, by query, by device, by country, plus prior-period comparisons).\n- Produce a plain-text “Insights” section, not JSON.\n\n## Rules\n\n### Formatting\n- Output **only** plain text.\n- DO NOT output the word \"Insight:\" at the beginning\n- Summarize everything into a single paragraph of **300–400 characters**.\n- Do **not** include lists, bullet points, or any JSON—just free-flowing prose.\n\n### Content\n- The paragraph must:\n 1. Summarize one key trend or change (e.g. a drop in clicks on a specific URL, a spike in impressions on a query).\n 2. Contrast current vs. prior period (using percentages or absolute numbers).\n 3. Suggest a concrete, actionable next step.\n 4. Be as specific as possible, focusing on specific keywords and pages\n\n- Write in idiomatic, professional English, with one clear recommendation.\n\n## Step-by-Step Instructions\n1. **Parse Input**: Read the incoming report object with fields like:\n - `overview` (clicks, impressions, ctr, position vs. prior)\n - `dateData` (daily metrics)\n - `pageData`, `queryData`, `deviceData`, `countryData`\n - prior-period equivalents\n2. **Identify Top Insights**:\n - Biggest drop or gain in clicks/impressions overall.\n - Pages or queries with largest percentage changes.\n - Biggest opportunity on CTR drop and impressions increase or click drops and impressions increase\n3. **Compose the Paragraph**:\n - Describe the metric change, e.g. “We noticed that the page /blog/… experienced a 32% drop…”\n - Be specific on pages and keywords, not only general metrics\n - Offer a hypothesis (e.g. “This could indicate…”).\n - End with an actionable recommendation (e.g. “Consider updating titles and meta descriptions…”).\n4. **Length Check**: Ensure the insight is between 300 and 400 characters.\n\n## Example Output\nInsights:\nWe noticed that the page /blog/2024/seo-strategy-guide experienced a 32% drop in clicks since April, despite a stable average position. This could indicate decreased search demand or less engaging titles/meta descriptions. The most urgent action is to refresh the title and meta description to better match user intent."
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "c39bd736-3d76-4236-b79f-9e1e52f0fd7a",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1800,
-180
],
"parameters": {
"color": 5,
"width": 580,
"height": 540,
"content": "## 要连接到Google OAuth2,您需要填写以下信息"
},
"typeVersion": 1
},
{
"id": "ccc3a82c-b906-4332-8739-e46b0e70f7d5",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1600,
840
],
"parameters": {
"color": 3,
"width": 360,
"height": 320,
"content": "**如果不确定您的siteUrl,请使用此节点检查用户有权访问的siteUrl列表**"
},
"typeVersion": 1
},
{
"id": "fd06a84f-de27-441d-9de9-e9691ea71d96",
"name": "HTTP请求 - Google Search Console - 列出我负责的SiteUrls",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-1480,
960
],
"parameters": {
"url": "=https://www.googleapis.com/webmasters/v3/sites",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api"
},
"credentials": {
"oAuth2Api": {
"id": "bGn73u7RA2mZCksv",
"name": "Google OAuth2"
},
"httpHeaderAuth": {
"id": "Z9SGcPUjCFlHCdPM",
"name": "Google Auth"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
}
],
"connections": {
"Merge": {
"main": [
[
{
"node": "Format data",
"type": "main",
"index": 0
}
]
]
},
"Pdforge": {
"main": [
[
{
"node": "Download Binary",
"type": "main",
"index": 0
}
]
]
},
"Format Date": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Format Page": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 3
}
]
]
},
"Format data": {
"main": [
[
{
"node": "Generating Insights for SEO Results",
"type": "main",
"index": 0
}
]
]
},
"Format Query": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Configuration": {
"main": [
[
{
"node": "HTTP Request - Google Search Console - Date",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Page",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Device",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Country",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Query - Previous Month",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Page - Previous month",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Overview",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Overview - Previous Month",
"type": "main",
"index": 0
},
{
"node": "HTTP Request - Google Search Console - Query",
"type": "main",
"index": 0
}
]
]
},
"Format Country": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 5
}
]
]
},
"Format Devices": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 4
}
]
]
},
"Split Out Date": {
"main": [
[
{
"node": "Format Date",
"type": "main",
"index": 0
}
]
]
},
"Download Binary": {
"main": [
[
{
"node": "Slack - Send Message with File",
"type": "main",
"index": 0
}
]
]
},
"Format Overview": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Split Out Pages": {
"main": [
[
{
"node": "Format Page",
"type": "main",
"index": 0
}
]
]
},
"Split Out Query": {
"main": [
[
{
"node": "Format Query",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Generating Insights for SEO Results",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Split Out Country": {
"main": [
[
{
"node": "Format Country",
"type": "main",
"index": 0
}
]
]
},
"Split Out Devices": {
"main": [
[
{
"node": "Format Devices",
"type": "main",
"index": 0
}
]
]
},
"Generate variables": {
"main": [
[
{
"node": "Pdforge",
"type": "main",
"index": 0
}
]
]
},
"Split Out Overview": {
"main": [
[
{
"node": "Format Overview",
"type": "main",
"index": 0
}
]
]
},
"Weekly at monday 8am": {
"main": [
[
{
"node": "Configuration",
"type": "main",
"index": 0
}
]
]
},
"Format Page - Previous month": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 8
}
]
]
},
"Format Query - Previous month": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 7
}
]
]
},
"Slack - Send Message with File": {
"main": [
[]
]
},
"Format Overview - Previous month": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 6
}
]
]
},
"Split Out Pages - Previous month": {
"main": [
[
{
"node": "Format Page - Previous month",
"type": "main",
"index": 0
}
]
]
},
"Split Out Query - Previous month": {
"main": [
[
{
"node": "Format Query - Previous month",
"type": "main",
"index": 0
}
]
]
},
"Generating Insights for SEO Results": {
"main": [
[
{
"node": "Generate variables",
"type": "main",
"index": 0
}
]
]
},
"Split Out Overview - Previous month": {
"main": [
[
{
"node": "Format Overview - Previous month",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Date": {
"main": [
[
{
"node": "Split Out Date",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Page": {
"main": [
[
{
"node": "Split Out Pages",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Query": {
"main": [
[
{
"node": "Split Out Query",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Device": {
"main": [
[
{
"node": "Split Out Devices",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Country": {
"main": [
[
{
"node": "Split Out Country",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Overview": {
"main": [
[
{
"node": "Split Out Overview",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Page - Previous month": {
"main": [
[
{
"node": "Split Out Pages - Previous month",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Query - Previous Month": {
"main": [
[
{
"node": "Split Out Query - Previous month",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Google Search Console - Overview - Previous Month": {
"main": [
[
{
"node": "Split Out Overview - Previous month",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 市场调研, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI驱动的Meta广告周度PDF报告 - 发送至Slack或邮箱
使用GPT-4洞察生成Meta广告周度性能报告并通过Slack发送
Set
Code
Slack
+8
14 节点Marcelo Abreu
市场调研
基于 GPT-4 专家的全面 SEO 审计,使用 Analytics、Search Console 和 PageSpeed
基于 GPT-4 专家的全面 SEO 审计,使用 Analytics、Search Console 和 PageSpeed
Set
Code
Merge
+8
38 节点Jimmy Gay
市场调研
带 AI 过滤的个性化学习内容聚合器
使用 GPT-4.1-mini 和 Google Sheets 从 Reddit 和 RSS 筛选学习内容
Set
Code
Merge
+7
18 节点higashiyama
市场调研
新抓取器_TechCrunch新闻-AI1
TechCrunch AI文章抓取与分类器,使用GPT-4.1-nano到Sheets和Telegram
Set
Code
Html
+12
18 节点Mujahid Kabae
市场调研
基于AI的会议研究与每日议程(Google日历、Attio CRM和Slack)
基于AI的会议研究与每日议程:使用Google日历、Attio CRM和Slack
If
Set
Code
+15
30 节点Harry Siggins
AI 摘要总结
使用Slack和Asana的虚拟Scrum Master
基于AI的Scrum Master助手,集成OpenAI、Slack和Asana
Set
Code
Html
+10
35 节点Łukasz
项目管理