Skip to content

Instantly share code, notes, and snippets.

@e3e6
Created July 18, 2025 14:40
Show Gist options
  • Select an option

  • Save e3e6/d78d649e259e7c6b6b2ca431760416ac to your computer and use it in GitHub Desktop.

Select an option

Save e3e6/d78d649e259e7c6b6b2ca431760416ac to your computer and use it in GitHub Desktop.
n8n notion get all issue
{
"nodes": [
{
"parameters": {
"functionCode": "return [\n { json: { name: 'Order #12345', text: 'This is a test for order #12345' } },\n { json: { name: 'Order #12345', text: 'Adding more info for the same order' } },\n { json: { name: 'Order #67890', text: 'A completely new order' } }\n];"
},
"name": "Input Items",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
340,
-80
],
"id": "45bcb099-82ef-469f-9dcd-0252f2dcbf8f"
},
{
"parameters": {
"resource": "databasePage",
"operation": "getAll",
"databaseId": {
"__rl": true,
"value": "22666fe6-e19b-80ad-b431-d39456740cfc",
"mode": "list",
"cachedResultName": "New Order Tracking Database",
"cachedResultUrl": "https://www.notion.so/"
},
"options": {
"filter": {
"singleCondition": {
"key": "Order Number|rich_text",
"condition": "equals",
"richTextValue": "={{ $json.name }}"
}
}
}
},
"name": "Search Page by Name",
"type": "n8n-nodes-base.notion",
"typeVersion": 1,
"position": [
560,
-80
],
"id": "1457cf96-5dbe-4875-a9a8-a15a7f04894b",
"alwaysOutputData": true,
"credentials": {
"notionApi": {
}
}
},
{
"parameters": {
"functionCode": "const existingPage = items[0].json.results && items[0].json.results[0];\nreturn [{\n json: {\n name: $json.name,\n text: $json.text,\n pageId: existingPage ? existingPage.id : null\n }\n}];"
},
"name": "Determine Page Status",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
760,
-80
],
"id": "ee3b1677-2d63-4bd0-8e66-ae46e126119c"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.pageId}}",
"operation": "isNotEmpty"
}
]
}
},
"name": "Page Exists?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
960,
-80
],
"id": "fecdb237-40ca-4d82-b01b-29c9338a54a2"
},
{
"parameters": {
"resource": "databasePage",
"databaseId": {
"__rl": true,
"value": "22666fe6-e19b-80ad-b431-d39456740cfc",
"mode": "list",
"cachedResultName": "New Order Tracking Database",
"cachedResultUrl": "https://www.notion.so/"
},
"options": {}
},
"name": "Create Page",
"type": "n8n-nodes-base.notion",
"typeVersion": 1,
"position": [
1160,
-180
],
"id": "f028cc4e-c488-4f2c-a52f-e963e33eaf40",
"credentials": {
"notionApi": {
"id": "XNFdTp2yR3hUGaMI",
"name": "Notion account"
}
}
},
{
"parameters": {
"functionCode": "return [{ json: {\n name: $json.name,\n text: $json.text,\n pageId: $json.pageId || $json.id\n} }];"
},
"name": "Normalize Page ID",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1360,
-60
],
"id": "e980f5bb-dec9-4346-a1f9-c17bc9e65608"
},
{
"parameters": {
"resource": "block",
"blockId": "={{$json.pageId}}"
},
"name": "Add Paragraph",
"type": "n8n-nodes-base.notion",
"typeVersion": 1,
"position": [
1560,
-60
],
"id": "851cc8f0-2de5-41df-8dc0-48b4d50deeba",
"credentials": {
"notionApi": {
"id": "XNFdTp2yR3hUGaMI",
"name": "Notion account"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
120,
-80
],
"id": "bf2dc136-6a03-40c3-8cd5-a628e193b49d",
"name": "When clicking ‘Test workflow’"
}
],
"connections": {
"Input Items": {
"main": [
[
{
"node": "Search Page by Name",
"type": "main",
"index": 0
}
]
]
},
"Search Page by Name": {
"main": [
[
{
"node": "Determine Page Status",
"type": "main",
"index": 0
}
]
]
},
"Determine Page Status": {
"main": [
[
{
"node": "Page Exists?",
"type": "main",
"index": 0
}
]
]
},
"Page Exists?": {
"main": [
[
{
"node": "Create Page",
"type": "main",
"index": 0
}
],
[
{
"node": "Normalize Page ID",
"type": "main",
"index": 0
}
]
]
},
"Create Page": {
"main": [
[
{
"node": "Normalize Page ID",
"type": "main",
"index": 0
}
]
]
},
"Normalize Page ID": {
"main": [
[
{
"node": "Add Paragraph",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Input Items",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "7f338e9db951775a07337f33543dfd713ead030abca21a5cfe7d741070d62635"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment