Slack File Upload from HTTP Node

Hey Community!

I’m trying to upload files directly to Slack using the HTTP Request node in n8n.
I cannot use the built-in Slack node because I need to dynamically use different auth tokens per workflow/client — so I need a flexible, credential-agnostic solution.

What I’m trying to do
The Slack API provides me with an upload_url and instructs to upload (POST) a file to this URL, just like this cURL command:
curl -X POST -T "myfile.jpg" -H "Content-Type: application/octet-stream" "https://files.slack.com/upload/v1/XXXXXXXX..."
This works perfectly and returns a 200 from Slack (or an empty HTML, as expected).

The problem

When I try to do the same upload using the HTTP Request node in n8n (I’ve tried all available Body Content Types: RAW, File, Form-Data), I always get an HTML response from Slack (looks like a generic web page, not a proper API response).

It seems like the file is not being uploaded in the exact same way as curl does (pure binary data, no multipart, no field).

I also tried to manually convert the file to a buffer from a base64 string, but then it uploaded the whole byte array (not the real binary).

My main question

How can I replicate this exact cURL behavior in n8n using the HTTP Request node? Specifically, how can I POST a file as plain binary data (no multipart, no encoding, no JSON), with a custom Content-Type, to a URL that changes dynamically?

Extra details:

  • The file is present in the binary section of the input item (binary.data).

  • The upload works with curl, but with n8n I only get HTML responses, never the expected result or a success.

Any examples, screenshots or working configurations for n8n v1.93+ would be greatly appreciated!

Thanks!