Hi,
I seem to be running into an issue where my Notion node is only getting one item from the previous input instead of iterating through all the items from the previous node as I was expecting. This is not an issue with the Notion node that is creating new database pages but it is when using the Notion node that executes the “Get All” operation on the database page resource.
Any help would be greatly appreciated.
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "592c697b-60cf-4ba0-89b0-a957d7f25d32",
"options": {
"responseData": ""
}
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
80,
-50
],
"webhookId": "592c697b-60cf-4ba0-89b0-a957d7f25d32"
},
{
"parameters": {},
"name": "Email Team Members",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1140,
110
]
},
{
"parameters": {
"resource": "databasePage",
"operation": "getAll",
"databaseId": "286cf9bb-97ce-4301-a311-3a128f165973",
"options": {
"filter": {
"singleCondition": {
"key": "Email|email",
"condition": "equals",
"multiSelectValue": [],
"emailValue": "={{$json[\"email\"]}}"
}
}
}
},
"name": "Query User",
"type": "n8n-nodes-base.notion",
"typeVersion": 1,
"position": [
490,
100
],
"alwaysOutputData": true,
"retryOnFail": false,
"executeOnce": false,
"notesInFlow": false,
"credentials": {
"notionApi": "n8n Oasis Workflows"
}
},
{
"parameters": {
"functionCode": "const newItems = [];\n\nfor (const item of items[0].json.body.teamMembers) {\n newItems.push({json: item});\n}\n\nreturn newItems;\n"
},
"name": "For Each Team Member",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
270,
100
],
"alwaysOutputData": false
},
{
"parameters": {
"resource": "databasePage",
"databaseId": "286cf9bb-97ce-4301-a311-3a128f165973",
"propertiesUi": {
"propertyValues": [
{
"key": "Name|title",
"title": "={{$node[\"For Each Team Member\"].json[\"name\"]}}",
"multiSelectValue": [],
"peopleValue": [],
"relationValue": []
},
{
"key": "Email|email",
"multiSelectValue": [],
"emailValue": "={{$node[\"For Each Team Member\"].json[\"email\"]}}",
"peopleValue": [],
"relationValue": []
}
]
}
},
"name": "Create Team Member",
"type": "n8n-nodes-base.notion",
"typeVersion": 1,
"position": [
930,
110
],
"credentials": {
"notionApi": "n8n Oasis Workflows"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ Object.keys($json).length == 0 }}",
"value2": true
}
]
}
},
"name": "If user does not exist",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
700,
100
],
"alwaysOutputData": false
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "For Each Team Member",
"type": "main",
"index": 0
}
]
]
},
"Query User": {
"main": [
[
{
"node": "If user does not exist",
"type": "main",
"index": 0
}
]
]
},
"For Each Team Member": {
"main": [
[
{
"node": "Query User",
"type": "main",
"index": 0
}
]
]
},
"Create Team Member": {
"main": [
[
{
"node": "Email Team Members",
"type": "main",
"index": 0
}
]
]
},
"If user does not exist": {
"main": [
[
{
"node": "Create Team Member",
"type": "main",
"index": 0
}
]
]
}
}
}