Need help trying to auto-download binary file using Webhooks

Describe the problem/error/question:

I’m trying to create a project where I can upload a PDF statement and automatically convert it to a CSV statement (there are checks involved to make sure the conversion is accurate), then be able to download this directly onto the user’s computer.

I believe everything is working properly except when it comes to downloading the actual statement. For some reason, I can’t get it to download. If someone could guide me on the solution that’d be super helpful

What is the error message (if any)?

I’m not getting any error message on the execution itself, but on my webpage (the GET webhook), it says “The webpage at https://treewalk.app.n8n.cloud/webhook/bankstatementoutput might be temporarily down or it may have moved permanently to a new web address.

Please share your workflow

Share the output returned by the last node

the last node outputted the correct CSV converted file with the correct name

Information on your n8n setup

  • n8n version: n8n cloud
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hmmm… Hey there ! :slight_smile:

Append mode supports multiple inputs (unlike Combine mode which only supports 2)

  • It will output all items from Code3, Code2, and File Name

  • Convert to File will receive the transaction data it needs to create the CSV

That’s it - just change the mode from “chooseBranch” to “Append” in your Merge1 node configuration, and give it a tri .

That didn’t seem to work. I don’t think the issue is getting the correct CSV statement along with the correct file name, its more so downloading the file onto the users computer directly. This is the error I see on the https://treewalk.app.n8n.cloud/webhook/bankstatementinput browser after executing. Also, here is a template from the n8n community that shows a workflow being able to download a document, I just don’t know why it won’t work for my workflow. Thanks for the help!

{
“nodes”: [
{
“parameters”: {
“path”: “download-pdf”,
“responseMode”: “responseNode”,
“options”: {}
},
“id”: “b242cc2c-00bf-45d7-b3cd-fb518299aa20”,
“name”: “On GET request”,
“type”: “n8n-nodes-base.webhook”,
“position”: [
-224,
-64
],
“webhookId”: “454eb4ea-e460-4196-b31c-284abf234fc3”,
“typeVersion”: 1
},
{
“parameters”: {
“url”: “https://www.deutschebahn.com/resource/blob/8813300/bdf106f07186f66e4448f95aca02bd4a/Faktenblatt-ICE-L_Mai23-data.pdf”,
“options”: {
“response”: {
“response”: {
“responseFormat”: “file”
}
}
}
},
“id”: “f24ababb-bf29-4ebe-b02e-d844503f3682”,
“name”: “Fetch binary file”,
“type”: “n8n-nodes-base.httpRequest”,
“position”: [
0,
-64
],
“typeVersion”: 4.1
},
{
“parameters”: {
“respondWith”: “binary”,
“options”: {
“responseHeaders”: {
“entries”: [
{
“name”: “content-disposition”,
“value”: “=attachment; filename=“my_document_{{ $now.toFormat(‘yyyy-MM-dd’) }}.pdf””
}
]
}
}
},
“id”: “24c5645d-3ff7-4664-bd15-0f13585cb75b”,
“name”: “Respond with attachment”,
“type”: “n8n-nodes-base.respondToWebhook”,
“position”: [
224,
-64
],
“typeVersion”: 1
}
],
“connections”: {
“On GET request”: {
“main”: [
[
{
“node”: “Fetch binary file”,
“type”: “main”,
“index”: 0
}
]
]
},
“Fetch binary file”: {
“main”: [
[
{
“node”: “Respond with attachment”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “3924636c53f63b110744ce8cc66414b8ffa56ff31ecfb3d421022be01f2d6551”
}
}