Sometimes, you may need the ability to download files directly through a webhook response — whether it’s for generating reports, exporting data, or automating file delivery.
This guide explains how to configure a webhook response to facilitate file downloads with the correct filename and format.
-
Get the Binary File
You can use any node that provides file output, such as cloud storage nodes, JavaScript nodes, etc.
-
Set Up the Webhook Response Headers:
content-type
: Specify the file type, e.g.,application/csv
for CSV files.content-disposition
: Useattachment; filename="yourfilename.csv"
to prompt download with the specified filename.
-
Pass the File Content in the Body of the Webhook:
{{$19.result.file.content}}
Example Headers:
-
Key:
content-type
Value:application/csv
-
Key:
content-disposition
Value:attachment; filename="yourfilename.csv"
Now, when the webhook is triggered, the file will download automatically with the correct name and extension.