How do I get just the "body" from a webhook?

Hi!

Like this:

From:

You can use a function node after the webhook node. Check the example below.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "cd2f7bfe-1dfd-4fd3-8f53-cf1b286ad624",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        460,
        300
      ],
      "webhookId": "cd2f7bfe-1dfd-4fd3-8f53-cf1b286ad624"
    },
    {
      "parameters": {
        "functionCode": "const result = []\n\nfor (const item of items) {\n  result.push({ json: item.json.body })\n}\n\nreturn result;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        660,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
2 Likes

Yes, that’s what I need!
Thank you Ricardo!