I have a chatbot running in n8n. It utilizes an AI agent with tools, including a tool to download binary content through an API. It can retrieve the file content with no issue, creating a binary data object which I can confirm in the execution trace. However, I need to present the user with a link or button by which they can download the content as a file, to their own PC. I’m not seeing a way to do this. If there is perhaps a function which could return a download link, which could then be included in the chat response, that should be sufficient.
To provide file downloads from your chatbot, you’ll need to create a webhook endpoint that serves the file with proper download headers. Here’s the approach:
• Set up a **Webhook** node to receive download requests with a file ID parameter
• Use the **Respond to Webhook** node with these headers:
-
`Content-Disposition: attachment; filename=“your-file.ext”`
-
Set the response body to your binary data
• Store the binary data temporarily (in memory or database) with a unique ID
• Return a download URL in your chat response like: `https://your-n8n-url/webhook/download?fileId=123\`
Check out this [n8n.io]( Respond with file download to incoming HTTP request | n8n workflow template ) workflow template that demonstrates exactly how to respond with file downloads. The [community.n8n.io]( How to create download link with file name ) discussion also shows how to set dynamic filenames using the Content-Disposition header.