Webhook Trigger NDJSON Requests

Hey there!

I’m trying to receive the data from Elastic and process it using n8n workflows. But there is an issue. Elastic can send plaintext (that is not convenient to work with), and ndjson. There is a way to receive requests on the webhook trigger with Content-Type: application/x-ndjson? Because all my tries failed. When I send data to the n8n, the entire body is empty. I tried to send the same data to a custom webhook, and it works. But not in n8n.

Hi @ka4a, welcome to the community!

Have you tried the Binary data option of the Webhook node?

This should cause the full payload to come in as a binary file you can then manually parse, for example like so:

This worked fine for the below request using a application/x-ndjson content-type header:

curl --request POST \
  --url https://myn8nhost/api-test/e8ecf556-f1bf-42d0-a6e9-692bce2627ee \
  --header 'Content-Type: application/x-ndjson' \
  --data '{
	"ticket": {
		"id": "foo",
		"customer": {
			"email": "[email protected]"


1 Like

Hey @MutedJam , I appreciate your help! Your answer is actually what I needed. But could you please help me with one more thing?

I need to say that I send the data to n8n from elastic. And there is no way to send the normal array to n8n. When I’m trying to send an array, I’m getting a JSON string with backslashes.

So I discovered this way of getting that data using ndjson content-type. But I can not send a normal array to webhook. Instead, I can send separate objects (it will look like {}{}{}), or I can send objects with some formatting (I made this one: [{},{},{},]. But there is a problem, the last coma is failing my node “Binary to JSON” (and I can’t remove it with elastic).

And the question is: There is a way to process this binary data before converting it to JSON?

Okay, nevermind. I just fixed my issue using the other side of my system. Thank you for your help! I appreciate!

1 Like

Glad to hear, thanks so much for confirming!