Webhook required inputs

How can I make a workflow which returns its inputs from the starting webhook, and the output of the respond to webhook node?

I am calling N8N workflows from another page I have using the webhook node and to add the workflow activation, I need the input and output parameters of the workflow itself.

I could go in to every workflow and get the information manually, but is there a better way for it?

Example workflow

{
  "nodes": [
    {
      "parameters": {
        "path": "7f9be095-02d6-4b03-9a91-cd4e1d1f24f4",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "id": "c37e8eb4-2e40-4eae-b3db-c6a7e7c267c2",
      "name": "Webhook",
      "webhookId": "7f9be095-02d6-4b03-9a91-cd4e1d1f24f4"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        220,
        0
      ],
      "id": "d4661ccf-eefe-48be-bed5-02d5798ad85a",
      "name": "Run the workflow"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"myoutput1\": \"outputExample\",\n  \"myoutput2\": \"outputExample2\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        440,
        0
      ],
      "id": "49463c3f-9504-49e1-a5ea-ca3f0c2ad514",
      "name": "Respond to Webhook"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Run the workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run the workflow": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "Webhook": [
      {
        "headers": {
          "header1": "example header"
        },
        "params": {},
        "query": {},
        "body": {
          "data": {
            "input1": "something",
            "input2": "something else"
          }
        },
        "webhookUrl": "http://localhost:5678/webhook-test/7f9be095-02d6-4b03-9a91-cd4e1d1f24f4",
        "executionMode": "test"
      }
    ]
  },
  "meta": {
    "instanceId": "eaabda8ba70da396a89aa4eab024c418f9af48f01fb72bf1441102e99715b021"
  }
}

In this case I would like to get the body element of the webhook input and the output elements so something like this:

"input":{
  "data": {
    "input1": string,
    "input2": int
  }
},
"output":{
  "myoutput1": string,
  "myoutput2": boolean
}

It doesn’t really matter what format it has, I just need the input and output variables collected in one place.

Is there a way to make this automatic for all workflows?

Thanks in advance.

Information on my n8n setup

  • n8n version: 1.88.0
  • Running n8n via: Docker
  • Operating system: Windows 11

You don’t need Run the Workflow node in-between. just Webhook and Respond to Webhook is fine.

I know, this was just an example.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.