Webhook Extract JSON Raw Content

Hi all,
i simply try to extract json from raw body on webhook node.
The event works with webhook.site.

I just put a webhook and a move binary data but i am not able to retrieve the json like webhook.site

Thanks

image



{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "damevent",
        "options": {
          "rawBody": true
        }
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        -100,
        -40
      ],
      "webhookId": "77665112-3d2c-43cb-b63b-c14a3bb07228"
    },
    {
      "parameters": {
        "setAllData": false,
        "options": {}
      },
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        100,
        -40
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Can you send it with content-type set to application/json? Then the middleware should recognize it correctly.

Hi,
I have no control on this application

I just tried with sending data via this workflow:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {a:1}\n  }\n];"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "http://localhost:5678/webhook-test/d82bc5ab-50a5-4cd6-9f9e-401386abedd8",
        "responseFormat": "string",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "json",
          "bodyContentCustomMimeType": "application/vnd.phraseanet.event+json"
        },
        "bodyParametersJson": "={{$json}}"
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

and receiving with this:

{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "d82bc5ab-50a5-4cd6-9f9e-401386abedd8",
        "options": {
          "binaryData": true
        }
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "webhookId": "d82bc5ab-50a5-4cd6-9f9e-401386abedd8"
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Worked in this case totally fine for me. If not for you, please send a curl command or n8n workflow which makes a total identical request to the one you receive from that service. Thanks!

Ha ok,
you work with Binary data and not Raw Body.
I thought Binary data was only used with file :~(

It works, thanks

Because the application sends that strange mime-type and not the regular JSON one, does n8n use it as a file.

Glad to hear that it solved your problem. Have fun!