How can I specify the paths for “Loop over items” and “filter” nodes in the workflow payload using the n8n API to create a workflow? Here is a specific video of my question
Please share your workflow
The payload I am using in the workflow creation API call looks like this:
you can see the sample payload if you create the workflow manually and copy the desired nodes to the notepad.
About the Loop node:
first array element in the connection - is the Done branch, and the second one - The Loop branch
{
"connections": {
"Loop Over Items": {
"main": [ // it always will be main
[ // first element is for the Done branch
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[ // second element is for the Loop branch
{
"node": "get campaign analytics1",
"type": "main",
"index": 0
}
]
]
}
}
}
About the IF node: it’s the same, but the first element is for the true branch, and the next one is for the false branch
{
"connections": {
"campaign exists in Notion1": {
"main": [ // it always will be main
[ // true branch
{
"node": "update campaign analytics",
"type": "main",
"index": 0
}
],
[ // false branch
{
"node": "create campaign analytics",
"type": "main",
"index": 0
}
]
]
}
},
}