{"id":115,"name":"Archive empty pages in Notion Database","nodes":[{"name":"Get All Databases","type":"n8n-nodes-base.notion","position":[240,300],"parameters":{"resource":"database","operation":"getAll","returnAll":true},"credentials":{"notionApi":{"id":"{{ $credentials.notionApi.id }}","name":"Notion account"}},"typeVersion":2,"id":"966882fd-9b43-4e6a-a5b1-f4901ff09dc2","notes":"This notion node performs automated tasks as part of the workflow."},{"name":"Get All Database Pages","type":"n8n-nodes-base.notion","position":[420,300],"parameters":{"simple":false,"options":{},"resource":"databasePage","operation":"getAll","returnAll":true,"databaseId":"={{$json[\"id\"]}}"},"credentials":{"notionApi":{"id":"{{ $credentials.notionApi.id }}","name":"Notion account"}},"typeVersion":2,"id":"e0f10344-b5c2-46af-a415-4fc3644bf0e5","notes":"This notion node performs automated tasks as part of the workflow."},{"name":"Get Page Blocks","type":"n8n-nodes-base.notion","position":[1180,280],"parameters":{"blockId":"={{$json[\"id\"]}}","resource":"block","operation":"getAll","returnAll":true},"credentials":{"notionApi":{"id":"{{ $credentials.notionApi.id }}","name":"Notion account"}},"typeVersion":2,"alwaysOutputData":true,"id":"1ba47d6f-a07f-4410-ba61-6563b8642d9c","notes":"This notion node performs automated tasks as part of the workflow."},{"name":"Process Blocks","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,"id":"188eeed5-353f-43d2-b39b-682f77012652","notes":"This function node performs automated tasks as part of the workflow."},{"name":"SplitInBatches","type":"n8n-nodes-base.splitInBatches","position":[1000,280],"parameters":{"options":{},"batchSize":1},"typeVersion":1,"id":"f084e13b-2719-42fe-b49e-cbdc8f051ca4","notes":"This splitInBatches node performs automated tasks as part of the workflow."},{"name":"Check for empty properties","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,"id":"955a39c7-38b0-4720-8423-fc246af7ba3c","notes":"This function node performs automated tasks as part of the workflow."},{"name":"Archive Page","type":"n8n-nodes-base.notion","position":[1760,260],"parameters":{"pageId":"={{$json[\"pageID\"]}}","operation":"archive"},"credentials":{"notionApi":{"id":"{{ $credentials.notionApi.id }}","name":"Notion account"}},"typeVersion":2,"id":"82e0fe4d-0929-4488-9b41-a24aa64b8879","notes":"This notion node performs automated tasks as part of the workflow."},{"name":"If toDelete","type":"n8n-nodes-base.if","position":[1560,280],"parameters":{"conditions":{"boolean":[{"value1":"={{$json[\"toDelete\"]}}","value2":true}]}},"typeVersion":1,"id":"cacd1371-d642-42ea-ae85-58911b142b2f","notes":"This if node performs automated tasks as part of the workflow."},{"name":"If Empty Properties","type":"n8n-nodes-base.if","position":[760,300],"parameters":{"conditions":{"boolean":[{"value1":"={{$json[\"toDelete\"]}}","value2":true}]}},"typeVersion":1,"id":"fa45450d-32c4-4127-a3b6-5d9687ceff65","notes":"This if node performs automated tasks as part of the workflow."},{"name":"Every day @ 2am","type":"n8n-nodes-base.cron","position":[80,300],"parameters":{"triggerTimes":{"item":[{"hour":2}]}},"typeVersion":1,"id":"a83a20c4-0386-495f-8845-9845bb5158c2","notes":"This cron node performs automated tasks as part of the workflow."},{"id":"error-c9ed1598","name":"Error Handler","type":"n8n-nodes-base.stopAndError","typeVersion":1,"position":[1000,400],"parameters":{"message":"Workflow execution error","options":{}}}],"active":false,"settings":{"executionOrder":"v1","saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner","errorWorkflow":null,"timezone":"UTC","executionTimeout":3600,"maxExecutions":1000,"retryOnFail":true,"retryCount":3,"retryDelay":1000},"connections":{},"description":"Automated workflow: Archive empty pages in Notion Database. This workflow processes data and performs automated tasks.","meta":{"instanceId":"workflow-30836856","versionId":"1.0.0","createdAt":"2025-09-29T07:07:52.429289","updatedAt":"2025-09-29T07:07:52.429299","owner":"n8n-user","license":"MIT","category":"automation","status":"active","priority":"high","environment":"production"},"notes":"Excellent quality workflow: Archive empty pages in Notion Database. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}