Inital Data in the start node

Hi,

n8n is super cool but I am not understanding something, why the start node (the one with the green arrow) is not having a parameter that could be the initial data to test the flow. This will avoid having for instance to use PostMan or Curl to trigger some flows. Did I missed something?

Hi @Krysalead,

You can use the Set Node which sounds like it will do what you are after so go from the Start to Set then you can move on from there or if you have something specific you want to emulate there is always the function option.

1 Like

If you are just wondering how to start the worklfow while developing it, you have two options:

  1. run the whole workflow;
  2. run set by step, but you need to start running the start node at first;

I made a test workflow very simple that has fixed data in order to see the flow. You can try ctrl+c the code below and paste it to the n8n canvas:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        0,
        250
      ]
    },
    {
      "parameters": {
        "functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nfor (item of items) {\n  item.json.myNewField = 1;\n}\n\nitems = [\n{json: {name: \"a\"}},\n{json: {name: \"b\"}},\n{json: {name: \"c\"}}\n]\n\n// You can write logs to the browser console\nconsole.log(items);\n\nreturn items;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        200,
        250
      ]
    },
    {
      "parameters": {
        "functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nfor (item of items) {\n  item.json.myNewField2 = 1;\n  //console.log(item);\n}\n\n// You can write logs to the browser console\nconsole.log(items);\n\nreturn items;"
      },
      "name": "Function1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        600,
        250
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {
          "reset": false
        }
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        400,
        250
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"]}}",
              "value2": "={{true}}"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        750,
        500
      ]
    },
    {
      "parameters": {},
      "name": "Function2",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        960,
        430
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function1": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Function1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "Function2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Regards.

2 Likes

@reichert, we feel your pain! This is on our roadmap (along with a more general overhaul of trigger nodes)