Can somebody tell me why this does not work? It worked with my workflow #100 but not my workflow #51
This is my workflow 51 btw:
My goal is to implement a bulk replace.
Can somebody tell me why this does not work? It worked with my workflow #100 but not my workflow #51
This is my workflow 51 btw:
My goal is to implement a bulk replace.
It looks like when updating a workflow we only expect name
, nodes
,connections
, settings
and an optional staticData
when you use the Get Workflow it returns more fields so you would need to remove the extras. Something like the below should do that for you.
Thanks for the answer. I am still getting the 400.
Here is my code (I just modified it to run for every item):
Here is the exact json I’m inputting to the end node:
[
{
"name": "System: Add Tasks for Assignment",
"nodes": [
{
"parameters": {},
"id": "71880fb7-2ead-487c-bd80-70d6ca7adc24",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1,
"position": [
400,
1000
]
},
{
"parameters": {},
"id": "ca9cf3d9-be21-4bfa-b65f-6b5403e13955",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
540,
1340
]
},
{
"parameters": {
"workflowId": "4"
},
"id": "9a3c71e3-1368-4715-aecb-a7af7d325a77",
"name": "Get Working-Memory Thought",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
760,
1160
]
},
{
"parameters": {
"content": "## Workflow Description\n\nThis workflow create Tasks for the current Assignment, based on the current plan.\n\n## Status\n\nFunctional.",
"height": 343.9999872381046,
"width": 442.97192587461734
},
"id": "d5a36639-5db1-4ef6-b962-07e69d8f4cc9",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1120,
620
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json.thoughts[0].id }}"
}
]
}
},
"id": "348b9207-1a4f-4093-bea2-fc18c4358e81",
"name": "IF Thoughts",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
600,
1000
]
},
{
"parameters": {
"workflowId": "87"
},
"id": "d291ca0d-eb31-43d8-af84-bb6ebea3d19d",
"name": "Authorization",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
920,
1000
]
},
{
"parameters": {
"fieldToSplitOut": "thoughts",
"options": {}
},
"id": "2fd1a085-f7b3-4620-9beb-fca6abfcd419",
"name": "Thought",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
1120,
1000
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "={{ $workflow.name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/[\\s_]+/g, '-').replace(/[^a-z0-9-]/gi, '').toLowerCase() }}",
"responseMode": "lastNode",
"options": {}
},
"id": "be7ce767-68dd-4349-be38-40d4641078f6",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
200,
840
],
"webhookId": "60f802b5-2a98-4f86-9ef2-b7a8abe2cee7"
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "var thoughts = $json[\"body\"];\n\nif (typeof thoughts == \"string\") {\n thoughts = JSON.parse(thoughts);\n}\n\nreturn { \"json\": thoughts};"
},
"id": "a7e3a092-2340-450e-a4fd-d17b0221d075",
"name": "Get Body",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
400,
840
]
},
{
"parameters": {
"url": "= https://{{ ($node[\"Thought\"].json[\"instance\"])?$node[\"Thought\"].json[\"instance\"]:\"simba\" }}-71e4f70.svc.us-east1-gcp.pinecone.io/vectors/fetch",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "namespace",
"value": "plans"
},
{
"name": "ids",
"value": "current-plan"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
},
{
"name": "content-type",
"value": "application/json"
}
]
},
"options": {}
},
"id": "e61234c7-171d-4bc2-87dc-118bfdbab1cb",
"name": "Fetch Current Plan",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1320,
1000
],
"credentials": {
"httpHeaderAuth": {
"id": "3",
"name": "Pinecone 2 - Header Auth account"
}
}
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "var plan = $json.vectors[\"current-plan\"].metadata;\nvar numbers = plan.text.match(/\\d+/g);\n\nvar tasks = [];\nfor (const number of numbers) {\n tasks.push({\"thought\": plan, \"number\":number});\n}\n\nreturn { \"json\": {\"thoughts\": tasks}};"
},
"id": "6251a513-9565-4baf-a3d9-17e8f6ea0102",
"name": "Format data5",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
1520,
1000
]
},
{
"parameters": {
"workflowId": "2"
},
"id": "71c2bb12-e19c-49a0-9b8d-c8f49b8369bf",
"name": "Stack4",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
2320,
1000
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "text",
"value": "=### Plan\n\n{{ $node[\"Fetch Current Plan\"].json[\"vectors\"][\"current-plan\"][\"metadata\"][\"text\"] }}\n\n### Current Thought\n\n{{ $node[\"Thought\"].json[\"text\"] }}\n\n### Task\n\nBased on the provided information, write a description with context of the Step number {{ $node[\"Plan Task\"].json[\"thoughts\"][\"number\"] }} of the Plan.\n\nStep #{{ $node[\"Plan Task\"].json[\"thoughts\"][\"number\"] }}:"
}
]
},
"options": {}
},
"id": "9cdbca59-2b8f-4166-a4bc-352f052bb394",
"name": "Set Task",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1920,
1000
]
},
{
"parameters": {
"fieldToSplitOut": "thoughts",
"include": "allOtherFields",
"options": {}
},
"id": "04467a0a-4349-4d3a-8936-e9e4cbe88eab",
"name": "Plan Task",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
1720,
1000
]
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "var thought = {};\n\n//System\nthought[\"instance\"] = $item(0).$node[\"Thought\"].json[\"instance\"];\nthought[\"calledFrom\"] = $workflow.name;\n\n// Input \nthought[\"text\"] = $json[\"text\"];\nthought[\"user\"] = \"myself\";\nthought[\"telegramChatId\"] = $item(0).$node[\"Thought\"].json[\"telegramChatId\"];\nthought[\"plan\"] = $item(0).$node[\"Fetch Current Plan\"].json.vectors[\"current-plan\"].metadata.text;\n\n// Parameters\nthought[\"namespace\"] = \"tasks\";\n//thought[\"step\"] = $workflow.name;\n\nreturn { \"json\": {\"thoughts\": [thought]}};"
},
"id": "29599de6-e7ba-4201-98a1-e4a6896af958",
"name": "Format input: attach plan",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
2120,
1000
]
},
{
"parameters": {
"workflowId": "118"
},
"id": "0743187e-98f5-45f8-98b4-b63fc4b80b88",
"name": "Do Foreach Entity",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
760,
1340
]
}
],
"connections": {
"Execute Workflow Trigger": {
"main": [
[
{
"node": "IF Thoughts",
"type": "main",
"index": 0
}
]
]
},
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Do Foreach Entity",
"type": "main",
"index": 0
}
]
]
},
"Get Working-Memory Thought": {
"main": [
[
{
"node": "Authorization",
"type": "main",
"index": 0
}
]
]
},
"IF Thoughts": {
"main": [
[
{
"node": "Authorization",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Working-Memory Thought",
"type": "main",
"index": 0
}
]
]
},
"Authorization": {
"main": [
[
{
"node": "Thought",
"type": "main",
"index": 0
}
]
]
},
"Thought": {
"main": [
[
{
"node": "Fetch Current Plan",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Get Body",
"type": "main",
"index": 0
}
]
]
},
"Get Body": {
"main": [
[
{
"node": "IF Thoughts",
"type": "main",
"index": 0
}
]
]
},
"Format data5": {
"main": [
[
{
"node": "Plan Task",
"type": "main",
"index": 0
}
]
]
},
"Set Task": {
"main": [
[
{
"node": "Format input: attach plan",
"type": "main",
"index": 0
}
]
]
},
"Plan Task": {
"main": [
[
{
"node": "Set Task",
"type": "main",
"index": 0
}
]
]
},
"Format input: attach plan": {
"main": [
[
{
"node": "Stack4",
"type": "main",
"index": 0
}
]
]
},
"Fetch Current Plan": {
"main": [
[
{
"node": "Format data5",
"type": "main",
"index": 0
}
]
]
},
"Do Foreach Entity": {
"main": [
[
{
"node": "Thought",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"saveManualExecutions": false,
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "6"
},
"staticData": {
"node:Schedule Trigger": {
"recurrencyRules": []
}
}
}
]
Does your workflow have any settings in it?
@Jon Yes it does, but nothing out of the ordinary:
"settings":
{
"saveManualExecutions":
false,
"callerPolicy":
"workflowsFromSameOwner",
"errorWorkflow":
"6"
},
This is the full input JSON:
[
{
"name": "Ask Tutor",
"nodes": [
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "var thought = {};\n\n//System\nthought[\"instance\"] = $node[\"Thought\"].json[\"instance\"];\nthought[\"calledFrom\"] = $workflow.name;\n\n// Input \nthought[\"text\"] = $json[\"text\"];\nthought[\"user\"] = $node[\"Thought\"].json[\"user\"];\n\n// Parameters\nthought[\"step\"] = $workflow.name;\n\nreturn { \"json\": {\"thoughts\": [thought]}};"
},
"id": "c0e86381-880f-4274-86c3-3f23754f0ca5",
"name": "Format data4",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
6060,
1460
]
},
{
"parameters": {
"content": "## Workflow Description\n\nThis Acting Workflow sends a message to the ACE's tutor (main contact point). This is useful to get advice on how to improve.\n\n## Status\n\nFunctional.",
"height": 343.9999872381046,
"width": 440.25960018454884
},
"id": "21e8e1ad-efd2-48fb-a5f1-37dd785e4ba3",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
5640,
1080
]
},
{
"parameters": {},
"id": "28fe8e83-30a4-4bc5-b5fb-13d72400d9b1",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1,
"position": [
4900,
1460
]
},
{
"parameters": {},
"id": "c72517ea-45c2-465a-9377-1503005e52d2",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
4900,
1620
]
},
{
"parameters": {
"workflowId": "4"
},
"id": "490e4b61-1e15-4981-8306-a0fe339cee0e",
"name": "Get Working-Memory Thought",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
5280,
1620
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ Array.isArray($json[\"thoughts\"]) }}",
"value2": true
}
]
}
},
"id": "ff579c8e-3339-45ba-a123-4bf0ea729368",
"name": "IF Thoughts",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
5120,
1460
]
},
{
"parameters": {
"workflowId": "87"
},
"id": "980f1ee1-c52d-4bf8-9540-45e94a43b6e2",
"name": "Authorization",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
5420,
1460
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "={{ $workflow.name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/[\\s_]+/g, '-').replace(/[^a-z0-9-]/gi, '').toLowerCase() }}",
"responseMode": "lastNode",
"options": {}
},
"id": "77468879-e1d2-4dab-ae52-d840cd741ca3",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
4700,
1320
],
"webhookId": "60f802b5-2a98-4f86-9ef2-b7a8abe2cee7"
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "var thoughts = $json[\"body\"];\n\nif (typeof thoughts == \"string\") {\n thoughts = JSON.parse(thoughts);\n}\n\nreturn { \"json\": thoughts};"
},
"id": "e4b36705-84bc-454a-acf5-a92b30e64b34",
"name": "Get Body",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
4900,
1320
]
},
{
"parameters": {
"workflowId": "45"
},
"id": "a284c62e-8da8-4eb8-bdec-b02bb26245c8",
"name": "Send Message",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
6280,
1460
]
},
{
"parameters": {
"fieldToSplitOut": "thoughts",
"options": {}
},
"id": "1536abfa-a31e-49a8-952b-97d43cc8bc1e",
"name": "Thought",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
5640,
1460
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "text",
"value": "=### Current Thought\n\n{{ $node[\"Thought\"].json[\"text\"] }}\n\n### Ask Tutor\n\nI decided to ask my tutor for anwsers about this."
}
]
},
"options": {}
},
"id": "a9849dad-ae2f-43f9-a1b1-82b6319cc3f4",
"name": "Set Ask My Tutor",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
5840,
1460
]
}
],
"connections": {
"Format data4": {
"main": [
[
{
"node": "Send Message",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow Trigger": {
"main": [
[
{
"node": "IF Thoughts",
"type": "main",
"index": 0
}
]
]
},
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Get Working-Memory Thought",
"type": "main",
"index": 0
}
]
]
},
"Get Working-Memory Thought": {
"main": [
[
{
"node": "Authorization",
"type": "main",
"index": 0
}
]
]
},
"IF Thoughts": {
"main": [
[
{
"node": "Authorization",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Working-Memory Thought",
"type": "main",
"index": 0
}
]
]
},
"Authorization": {
"main": [
[
{
"node": "Thought",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Get Body",
"type": "main",
"index": 0
}
]
]
},
"Get Body": {
"main": [
[
{
"node": "IF Thoughts",
"type": "main",
"index": 0
}
]
]
},
"Thought": {
"main": [
[
{
"node": "Set Ask My Tutor",
"type": "main",
"index": 0
}
]
]
},
"Set Ask My Tutor": {
"main": [
[
{
"node": "Format data4",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"saveManualExecutions": false,
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "6"
},
"staticData": null
}
]
Try removing the Caller Policy, We don’t have that in our docs for the API so that could be causing the issue for you.
I made it work by setting settings to {}.
I think the parameters “errorWorkflow” (or “saveManualExecution”) cannot be passed programmatically
From what I could see in the docs those should work I will do some more testing to see what is going on.