Literally just started using n8n and I’m already stumped. I’ve got a Plex Webhook set up, but the decision node is failing every time.
Can anyone spot the error in my logic? I feel like it should be working.
Literally just started using n8n and I’m already stumped. I’ve got a Plex Webhook set up, but the decision node is failing every time.
Can anyone spot the error in my logic? I feel like it should be working.
@nihya Does the content come from the http node?
Seems like the input is in binary JSON format, you have to convert the json binary into a JSON text output using “Extract From File” node. Choose that node and then use “Extract from JSON” operation, put the node between the node that produces the JSON binary file and the “If” node.
Something like this
Hi @nihya
The reason your IF node is failing is that Plex sends its data as multipart/form-data . If you look at your second screenshot, you can see that the data is arriving as a binary object named payload, rather than direct JSON. n8n’s IF node can’t ‘see’ the event key because it’s still trapped inside that binary file.
Here is how to fix it:
Add a Node before the IF Node: Insert the ‘Extract From File’ node (or ‘Move Binary Data’ node in older versions).
Configure it: Set the ‘Operation’ to ‘JSON’ . This will convert that binary payload into actual JSON data that n8n can read.
Update your IF Node: Now, in your IF node, make sure you are using an expression. Instead of just typing event, click the cloud icon (expression) and use:
{{ $json.event }}
(Or simply drag the ‘event’ field from the input panel into the value box).
Once the JSON is extracted from the binary payload, your logic will work perfectly!
If this answer was helpful for you, please mark it as the solution and give it a like!
Hey! Thanks a ton for the help. Just so you know, this content is coming through a Webhook.
this is the flow;
This is the Webhook Node
And this is the IF
Thanks for catching that. I’ll update the workflow to include the ‘Extract from File’ node with the ‘Extract from JSON’ operation as suggested.
Hey @nihya !
I suppose you wanna check if the event is library.new.
If you write expression (or drag and drop from Schema view the event (object/string etc…) into that field) and can compare.
Can you try that?
Cheers!
Webhhook → Code → IF …
Example Code data :
// Convert binary webhook data to JSON in n8n // 1️⃣ Get binary data (Base64 encoded) from webhook
// 2️⃣ Decode to UTF-8 text
// 3️⃣ Parse text into JSON for further processing
return items.map(item => {
// Access the binary property from the incoming webhook
const binaryData = item.binary.data.data;
// Convert Base64 buffer to UTF-8 String
const text = Buffer.from(binaryData, 'base64').toString('utf8');
// Parse string into a JSON object
const jsonData = JSON.parse(text);
return { json: jsonData };
});
// Convert binary webhook data to JSON in n8n // 1️⃣ Get binary data (Base64 encoded) from webhook // 2️⃣ Decode to UTF-8 text // 3️⃣ Parse text into JSON for further processing
const binaryData = items[0].binary.data.data; // Base64 string from webhook const text = Buffer.from(binaryData, 'base64').toString('utf8'); const jsonData = JSON.parse(text);
return [{ json: jsonData }];
Caption: This Function Node takes binary data from a webhook, decodes it from Base64, converts it to UTF-8 text, and then parses it into JSON. After this, you can work with the data in n8n as normal JSON objects
I’ve updated the IF node to use an expression for the event property.
This was it!
Thank you so much ![]()
You are welcome, kindly mark as the solution if you found this helpful.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.