在 Notion 数据库中归档空白页面
中级
这是一个Building Blocks领域的自动化工作流,包含 10 个节点。主要使用 If, Cron, Notion, Function, SplitInBatches 等节点。 归档 Notion 数据库中的空白页面
前置要求
- •Notion API Key
使用的节点 (10)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
无法加载工作流预览
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": 115,
"name": "在 Notion 数据库中归档空白页面",
"nodes": [
{
"name": "获取所有数据库",
"type": "n8n-nodes-base.notion",
"position": [
240,
300
],
"parameters": {
"resource": "database",
"operation": "getAll",
"returnAll": true
},
"credentials": {
"notionApi": {
"id": "36",
"name": "Notion account"
}
},
"typeVersion": 2
},
{
"name": "获取所有数据库页面",
"type": "n8n-nodes-base.notion",
"position": [
420,
300
],
"parameters": {
"simple": false,
"options": {},
"resource": "databasePage",
"operation": "getAll",
"returnAll": true,
"databaseId": "={{$json[\"id\"]}}"
},
"credentials": {
"notionApi": {
"id": "36",
"name": "Notion account"
}
},
"typeVersion": 2
},
{
"name": "获取页面块",
"type": "n8n-nodes-base.notion",
"position": [
1180,
280
],
"parameters": {
"blockId": "={{$json[\"id\"]}}",
"resource": "block",
"operation": "getAll",
"returnAll": true
},
"credentials": {
"notionApi": {
"id": "36",
"name": "Notion account"
}
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"name": "处理块",
"type": "n8n-nodes-base.function",
"position": [
1360,
280
],
"parameters": {
"functionCode": "let returnData = {\n json: {\n toDelete: false,\n pageID: $node[\"SplitInBatches\"].json[\"id\"],\n }\n};\n\nif (!items[0].json.id) {\n returnData.json.toDelete = true;\n return [returnData];\n}\n\nfor (item of items) {\n \n let toDelete = false;\n\n let type = item.json.type;\n let data = item.json[type];\n\n if (!toDelete) {\n if (data.text.length == 0) {\n toDelete = true;\n } else {\n returnData.json.toDelete = false;\n break;\n }\n }\n\n returnData.json.toDelete = toDelete;\n}\n\nreturn [returnData];"
},
"typeVersion": 1
},
{
"name": "分批处理",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1000,
280
],
"parameters": {
"options": {},
"batchSize": 1
},
"typeVersion": 1
},
{
"name": "检查空属性",
"type": "n8n-nodes-base.function",
"position": [
600,
300
],
"parameters": {
"functionCode": "for (item of items) {\n\n let toDelete = false;\n for (const key in item.json.properties) {\n let type = item.json.properties[key].type;\n let data = item.json.properties[key][type];\n \n if (!data || data.length == 0) {\n toDelete = true;\n } else {\n toDelete = false;\n break;\n }\n }\n\n item.json.toDelete = toDelete;\n}\n\nreturn items;"
},
"typeVersion": 1
},
{
"name": "归档页面",
"type": "n8n-nodes-base.notion",
"position": [
1760,
260
],
"parameters": {
"pageId": "={{$json[\"pageID\"]}}",
"operation": "archive"
},
"credentials": {
"notionApi": {
"id": "36",
"name": "Notion account"
}
},
"typeVersion": 2
},
{
"name": "如果需删除",
"type": "n8n-nodes-base.if",
"position": [
1560,
280
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$json[\"toDelete\"]}}",
"value2": true
}
]
}
},
"typeVersion": 1
},
{
"name": "如果属性为空",
"type": "n8n-nodes-base.if",
"position": [
760,
300
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$json[\"toDelete\"]}}",
"value2": true
}
]
}
},
"typeVersion": 1
},
{
"name": "每天凌晨2点",
"type": "n8n-nodes-base.cron",
"position": [
80,
300
],
"parameters": {
"triggerTimes": {
"item": [
{
"hour": 2
}
]
}
},
"typeVersion": 1
}
],
"active": false,
"settings": {},
"connections": {
"If toDelete": {
"main": [
[
{
"node": "Archive Page",
"type": "main",
"index": 0
}
]
]
},
"Process Blocks": {
"main": [
[
{
"node": "If toDelete",
"type": "main",
"index": 0
},
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "Get Page Blocks",
"type": "main",
"index": 0
}
]
]
},
"Every day @ 2am": {
"main": [
[
{
"node": "Get All Databases",
"type": "main",
"index": 0
}
]
]
},
"Get Page Blocks": {
"main": [
[
{
"node": "Process Blocks",
"type": "main",
"index": 0
}
]
]
},
"Get All Databases": {
"main": [
[
{
"node": "Get All Database Pages",
"type": "main",
"index": 0
}
]
]
},
"If Empty Properties": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"Get All Database Pages": {
"main": [
[
{
"node": "Check for empty properties",
"type": "main",
"index": 0
}
]
]
},
"Check for empty properties": {
"main": [
[
{
"node": "If Empty Properties",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 构建模块
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
从多个 RSS 源获取数据到 Telegram
从多个 RSS 源获取数据到 Telegram
If
Cron
Function
+3
11 节点Valor
构建模块
新发票邮件通知
在Slack中通知带有发票的新邮件
If
Slack
Mindee
+2
6 节点Jonathan
销售
Dialpad 到 Syncro
将 Dialpad 通话信息推送到 Syncro
If
Set
Webhook
+4
22 节点Jonathan
IT 运维
Clockify 到 Syncro
将计时条目从 Clockify 同步到 Syncro
If
Set
Webhook
+4
13 节点Jonathan
销售
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
脸红粉红周 — 7天Pinterest规划器(n8n + Notion)
集成Notion与邮件发送功能的7天Pinterest内容规划器
If
Set
Cron
+6
17 节点Shelly-Ann Davy
社交媒体