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 →
{
"name": "WF-Main - XHS \u4e3b\u63a7\u5236\u5668",
"nodes": [
{
"id": "schedule-trigger",
"name": "\u5b9a\u65f6\u89e6\u53d1 (\u6bcf5\u5206\u949f)",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.3,
"position": [
0,
0
],
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 5
}
]
}
}
},
{
"id": "webhook-trigger",
"name": "Webhook \u624b\u52a8\u89e6\u53d1",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
0,
200
],
"parameters": {
"httpMethod": "POST",
"path": "xhs-pipeline",
"responseMode": "onReceived",
"options": {}
},
"onError": "continueRegularOutput"
},
{
"id": "merge-triggers",
"name": "\u5408\u5e76\u5165\u53e3",
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
250,
100
],
"parameters": {
"mode": "chooseBranch",
"output": "input1"
}
},
{
"id": "health-check",
"name": "\u722c\u866b\u5065\u5eb7\u68c0\u67e5",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
500,
100
],
"parameters": {
"method": "GET",
"url": "http://124.221.251.8:8080/api/health",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-API-Key",
"value": "dev-key"
}
]
},
"options": {
"timeout": 10000
}
},
"onError": "continueRegularOutput",
"retryOnFail": true,
"maxTries": 3
},
{
"id": "check-crawler-ready",
"name": "\u68c0\u67e5\u722c\u866b\u72b6\u6001",
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
750,
100
],
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "crawler-ready-check",
"leftValue": "={{ $json.crawler_ready }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
}
}
},
{
"id": "get-lark-token",
"name": "\u83b7\u53d6\u98de\u4e66Token",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1000,
0
],
"parameters": {
"method": "POST",
"url": "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={\"app_id\": \"{{ $env.LARK_APP_ID }}\", \"app_secret\": \"{{ $env.LARK_APP_SECRET }}\"}",
"options": {}
},
"onError": "continueRegularOutput",
"retryOnFail": true,
"maxTries": 3
},
{
"id": "query-keywords",
"name": "\u67e5\u8be2Keywords\u8868",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1250,
-150
],
"parameters": {
"method": "POST",
"url": "=https://open.feishu.cn/open-apis/bitable/v1/apps/{{ $env.LARK_APP_TOKEN }}/tables/{{ $env.KEYWORDS_TABLE_ID }}/records/search",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('\u83b7\u53d6\u98de\u4e66Token').item.json.tenant_access_token }}"
}
]
},
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "{\n \"filter\": {\n \"conjunction\": \"and\",\n \"conditions\": [\n {\n \"field_name\": \"status\",\n \"operator\": \"is\",\n \"value\": [\"\u5f85\u91c7\u96c6\"]\n }\n ]\n },\n \"page_size\": 5\n}",
"options": {}
}
},
{
"id": "query-topics",
"name": "\u67e5\u8be2Topics\u8868",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1250,
0
],
"parameters": {
"method": "POST",
"url": "=https://open.feishu.cn/open-apis/bitable/v1/apps/{{ $env.LARK_APP_TOKEN }}/tables/{{ $env.TOPICS_TABLE_ID }}/records/search",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('\u83b7\u53d6\u98de\u4e66Token').item.json.tenant_access_token }}"
}
]
},
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "{\n \"filter\": {\n \"conjunction\": \"and\",\n \"conditions\": [\n {\n \"field_name\": \"status\",\n \"operator\": \"is\",\n \"value\": [\"\u5f85\u63d0\u53d6\"]\n }\n ]\n },\n \"page_size\": 10\n}",
"options": {}
}
},
{
"id": "query-source",
"name": "\u67e5\u8be2Source\u8868",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1250,
150
],
"parameters": {
"method": "POST",
"url": "=https://open.feishu.cn/open-apis/bitable/v1/apps/{{ $env.LARK_APP_TOKEN }}/tables/{{ $env.SOURCE_TABLE_ID }}/records/search",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('\u83b7\u53d6\u98de\u4e66Token').item.json.tenant_access_token }}"
}
]
},
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "{\n \"filter\": {\n \"conjunction\": \"and\",\n \"conditions\": [\n {\n \"field_name\": \"status\",\n \"operator\": \"is\",\n \"value\": [\"\u5f85\u751f\u6210\"]\n }\n ]\n },\n \"page_size\": 5\n}",
"options": {}
}
},
{
"id": "query-content",
"name": "\u67e5\u8be2Content\u8868",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1250,
300
],
"parameters": {
"method": "POST",
"url": "=https://open.feishu.cn/open-apis/bitable/v1/apps/{{ $env.LARK_APP_TOKEN }}/tables/{{ $env.CONTENT_TABLE_ID }}/records/search",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('\u83b7\u53d6\u98de\u4e66Token').item.json.tenant_access_token }}"
}
]
},
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "{\n \"filter\": {\n \"conjunction\": \"and\",\n \"conditions\": [\n {\n \"field_name\": \"status\",\n \"operator\": \"is\",\n \"value\": [\"\u5f85\u53d1\u5e03\"]\n }\n ]\n },\n \"page_size\": 3\n}",
"options": {}
}
},
{
"id": "priority-dispatch",
"name": "\u4f18\u5148\u7ea7\u5206\u53d1",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1500,
100
],
"parameters": {
"mode": "runOnceForAllItems",
"language": "javaScript",
"jsCode": "// \u83b7\u53d6\u5404\u8868\u67e5\u8be2\u7ed3\u679c\nconst keywords = $('\u67e5\u8be2Keywords\u8868').all();\nconst topics = $('\u67e5\u8be2Topics\u8868').all();\nconst source = $('\u67e5\u8be2Source\u8868').all();\nconst content = $('\u67e5\u8be2Content\u8868').all();\n\n// \u63d0\u53d6\u8bb0\u5f55\u6570\nconst keywordsCount = keywords[0]?.json?.data?.items?.length || 0;\nconst topicsCount = topics[0]?.json?.data?.items?.length || 0;\nconst sourceCount = source[0]?.json?.data?.items?.length || 0;\nconst contentCount = content[0]?.json?.data?.items?.length || 0;\n\n// \u4f18\u5148\u7ea7\u5206\u53d1: Publish > Generation > Extraction > Discovery\nlet action = 'skip';\nlet records = [];\nlet table_id = '';\n\nif (contentCount > 0) {\n action = 'publish';\n records = content[0].json.data.items;\n table_id = $env.CONTENT_TABLE_ID;\n} else if (sourceCount > 0) {\n action = 'generation';\n records = source[0].json.data.items;\n table_id = $env.SOURCE_TABLE_ID;\n} else if (topicsCount > 0) {\n action = 'extraction';\n records = topics[0].json.data.items;\n table_id = $env.TOPICS_TABLE_ID;\n} else if (keywordsCount > 0) {\n action = 'discovery';\n records = keywords[0].json.data.items;\n table_id = $env.KEYWORDS_TABLE_ID;\n}\n\nreturn [{\n json: {\n action,\n records,\n table_id,\n counts: {\n keywords: keywordsCount,\n topics: topicsCount,\n source: sourceCount,\n content: contentCount\n },\n timestamp: new Date().toISOString()\n }\n}];"
}
},
{
"id": "action-switch",
"name": "\u8def\u7531\u5206\u53d1",
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
1750,
100
],
"parameters": {
"mode": "rules",
"rules": {
"values": [
{
"outputKey": "publish",
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.action }}",
"rightValue": "publish",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"outputKey": "generation",
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.action }}",
"rightValue": "generation",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"outputKey": "extraction",
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.action }}",
"rightValue": "extraction",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"outputKey": "discovery",
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.action }}",
"rightValue": "discovery",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {
"fallbackOutput": "extra"
}
}
},
{
"id": "exec-publish",
"name": "\u6267\u884c WF-Publish",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
2000,
-100
],
"parameters": {
"source": "database",
"workflowId": "={{ $env.WF_PUBLISH_ID }}"
}
},
{
"id": "exec-generation",
"name": "\u6267\u884c WF-Generation",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
2000,
50
],
"parameters": {
"source": "database",
"workflowId": "={{ $env.WF_GENERATION_ID }}"
}
},
{
"id": "exec-extraction",
"name": "\u6267\u884c WF-Extraction",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
2000,
200
],
"parameters": {
"source": "database",
"workflowId": "={{ $env.WF_EXTRACTION_ID }}"
}
},
{
"id": "exec-discovery",
"name": "\u6267\u884c WF-Discovery",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
2000,
350
],
"parameters": {
"source": "database",
"workflowId": "={{ $env.WF_DISCOVERY_ID }}"
}
},
{
"id": "skip-action",
"name": "\u65e0\u5f85\u5904\u7406\u4efb\u52a1",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
2000,
500
],
"parameters": {}
},
{
"id": "merge-results",
"name": "\u5408\u5e76\u6267\u884c\u7ed3\u679c",
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
2250,
200
],
"parameters": {
"mode": "chooseBranch"
}
},
{
"id": "log-execution",
"name": "\u8bb0\u5f55\u6267\u884c\u65e5\u5fd7",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
2500,
200
],
"parameters": {
"method": "POST",
"url": "=https://open.feishu.cn/open-apis/bitable/v1/apps/{{ $env.LARK_APP_TOKEN }}/tables/{{ $env.LOGS_TABLE_ID }}/records",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('\u83b7\u53d6\u98de\u4e66Token').item.json.tenant_access_token }}"
}
]
},
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={\n \"fields\": {\n \"workflow\": \"WF-Main\",\n \"action\": \"{{ $('\u4f18\u5148\u7ea7\u5206\u53d1').item.json.action }}\",\n \"status\": \"completed\",\n \"execution_time\": \"{{ $now.toISO() }}\",\n \"details\": \"{{ JSON.stringify($('\u4f18\u5148\u7ea7\u5206\u53d1').item.json.counts) }}\"\n }\n}",
"options": {}
}
},
{
"id": "crawler-not-ready",
"name": "\u722c\u866b\u672a\u5c31\u7eea\u544a\u8b66",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1000,
250
],
"parameters": {
"method": "POST",
"url": "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "{\n \"app_id\": \"{{ $env.LARK_APP_ID }}\",\n \"app_secret\": \"{{ $env.LARK_APP_SECRET }}\"\n}",
"options": {}
}
},
{
"id": "log-crawler-error",
"name": "\u8bb0\u5f55\u722c\u866b\u9519\u8bef",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1250,
250
],
"parameters": {
"method": "POST",
"url": "=https://open.feishu.cn/open-apis/bitable/v1/apps/{{ $env.LARK_APP_TOKEN }}/tables/{{ $env.LOGS_TABLE_ID }}/records",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('\u722c\u866b\u672a\u5c31\u7eea\u544a\u8b66').item.json.tenant_access_token }}"
}
]
},
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "{\n \"fields\": {\n \"workflow\": \"WF-Main\",\n \"action\": \"health_check\",\n \"status\": \"error\",\n \"execution_time\": \"{{ $now.toISO() }}\",\n \"details\": \"\u722c\u866b\u672a\u5c31\u7eea\uff0ccrawler_ready=false\"\n }\n}",
"options": {}
}
}
],
"connections": {
"\u5b9a\u65f6\u89e6\u53d1 (\u6bcf5\u5206\u949f)": {
"main": [
[
{
"node": "\u5408\u5e76\u5165\u53e3",
"type": "main",
"index": 0
}
]
]
},
"Webhook \u624b\u52a8\u89e6\u53d1": {
"main": [
[
{
"node": "\u5408\u5e76\u5165\u53e3",
"type": "main",
"index": 1
}
]
]
},
"\u5408\u5e76\u5165\u53e3": {
"main": [
[
{
"node": "\u722c\u866b\u5065\u5eb7\u68c0\u67e5",
"type": "main",
"index": 0
}
]
]
},
"\u722c\u866b\u5065\u5eb7\u68c0\u67e5": {
"main": [
[
{
"node": "\u68c0\u67e5\u722c\u866b\u72b6\u6001",
"type": "main",
"index": 0
}
]
]
},
"\u68c0\u67e5\u722c\u866b\u72b6\u6001": {
"main": [
[
{
"node": "\u83b7\u53d6\u98de\u4e66Token",
"type": "main",
"index": 0
}
],
[
{
"node": "\u722c\u866b\u672a\u5c31\u7eea\u544a\u8b66",
"type": "main",
"index": 0
}
]
]
},
"\u83b7\u53d6\u98de\u4e66Token": {
"main": [
[
{
"node": "\u67e5\u8be2Keywords\u8868",
"type": "main",
"index": 0
},
{
"node": "\u67e5\u8be2Topics\u8868",
"type": "main",
"index": 0
},
{
"node": "\u67e5\u8be2Source\u8868",
"type": "main",
"index": 0
},
{
"node": "\u67e5\u8be2Content\u8868",
"type": "main",
"index": 0
}
]
]
},
"\u67e5\u8be2Keywords\u8868": {
"main": [
[
{
"node": "\u4f18\u5148\u7ea7\u5206\u53d1",
"type": "main",
"index": 0
}
]
]
},
"\u67e5\u8be2Topics\u8868": {
"main": [
[
{
"node": "\u4f18\u5148\u7ea7\u5206\u53d1",
"type": "main",
"index": 0
}
]
]
},
"\u67e5\u8be2Source\u8868": {
"main": [
[
{
"node": "\u4f18\u5148\u7ea7\u5206\u53d1",
"type": "main",
"index": 0
}
]
]
},
"\u67e5\u8be2Content\u8868": {
"main": [
[
{
"node": "\u4f18\u5148\u7ea7\u5206\u53d1",
"type": "main",
"index": 0
}
]
]
},
"\u4f18\u5148\u7ea7\u5206\u53d1": {
"main": [
[
{
"node": "\u8def\u7531\u5206\u53d1",
"type": "main",
"index": 0
}
]
]
},
"\u8def\u7531\u5206\u53d1": {
"main": [
[
{
"node": "\u6267\u884c WF-Publish",
"type": "main",
"index": 0
}
],
[
{
"node": "\u6267\u884c WF-Generation",
"type": "main",
"index": 0
}
],
[
{
"node": "\u6267\u884c WF-Extraction",
"type": "main",
"index": 0
}
],
[
{
"node": "\u6267\u884c WF-Discovery",
"type": "main",
"index": 0
}
],
[
{
"node": "\u65e0\u5f85\u5904\u7406\u4efb\u52a1",
"type": "main",
"index": 0
}
]
]
},
"\u6267\u884c WF-Publish": {
"main": [
[
{
"node": "\u5408\u5e76\u6267\u884c\u7ed3\u679c",
"type": "main",
"index": 0
}
]
]
},
"\u6267\u884c WF-Generation": {
"main": [
[
{
"node": "\u5408\u5e76\u6267\u884c\u7ed3\u679c",
"type": "main",
"index": 1
}
]
]
},
"\u6267\u884c WF-Extraction": {
"main": [
[
{
"node": "\u5408\u5e76\u6267\u884c\u7ed3\u679c",
"type": "main",
"index": 2
}
]
]
},
"\u6267\u884c WF-Discovery": {
"main": [
[
{
"node": "\u5408\u5e76\u6267\u884c\u7ed3\u679c",
"type": "main",
"index": 3
}
]
]
},
"\u65e0\u5f85\u5904\u7406\u4efb\u52a1": {
"main": [
[
{
"node": "\u5408\u5e76\u6267\u884c\u7ed3\u679c",
"type": "main",
"index": 4
}
]
]
},
"\u5408\u5e76\u6267\u884c\u7ed3\u679c": {
"main": [
[
{
"node": "\u8bb0\u5f55\u6267\u884c\u65e5\u5fd7",
"type": "main",
"index": 0
}
]
]
},
"\u722c\u866b\u672a\u5c31\u7eea\u544a\u8b66": {
"main": [
[
{
"node": "\u8bb0\u5f55\u722c\u866b\u9519\u8bef",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 2,
"updatedAt": "2025-12-19T09:00:00.000Z",
"versionId": "1"
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
This workflow automates the monitoring and management of a Xiaohongshu (XHS) scraping system, ensuring reliable data extraction for market research or content analysis without manual intervention. It suits content creators, marketers, or data analysts who rely on XHS insights to track trends and keywords efficiently. The key step involves a scheduled trigger every five minutes that merges with manual webhooks, checks crawler health via HTTP requests, and queries databases for keywords and topics before executing sub-workflows.
Use this workflow for continuous oversight of XHS data pipelines in production environments where timely health checks prevent downtime. Avoid it for one-off scrapes or when real-time processing exceeds five-minute intervals, as it prioritises scheduled reliability over instant responses. Common variations include adjusting the cron schedule for hourly runs or integrating additional HTTP requests to notify teams via Lark when issues arise.
About this workflow
WF-Main - XHS 主控制器. Uses scheduleTrigger, httpRequest, executeWorkflow, noOp. Scheduled trigger; 21 nodes.
Source: https://github.com/wade56754/XHS/blob/b5b999f35721bcfe8ffc6b518245e1d8dbaab5c5/n8n-workflows/WF-Main.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Dm-Profile-Visitors. Uses httpRequest, googleSheets. Scheduled trigger; 21 nodes.
RSS to Multi-Channel Social (X / LinkedIn / Discord). Uses stickyNote, scheduleTrigger, httpRequest. Scheduled trigger; 19 nodes.
YouTube Channel to Notion. Uses stickyNote, scheduleTrigger, httpRequest, noOp. Scheduled trigger; 18 nodes.
Automate Droplet Snapshots On Digitalocean. Uses httpRequest, stickyNote. Scheduled trigger; 17 nodes.
Calendar Conflict Detector (Google / Outlook). Uses stickyNote, scheduleTrigger, httpRequest. Scheduled trigger; 16 nodes.