The Problem: Sending binary files (attachments) and their metadata into an n8n sub-workflow can be tricky. You need both the file data and information like the file type.
The Solution: Use “Define using JSON example” in the Sub-Workflow node.
1. Access Binary Data:
{{$('Node Name').item.binary}}
For multiple files, consider:
{{Array.of($('Your Trigger Node').item.binary)}}
2. Sub-Workflow Input Configuration:
Set Input data mode to Define using JSON example
.
3. JSON Example:
{
"binary_files": ["list"],
"data": {"yourKey": "yourValue"},
"metadata": {
"file_type": "e.g., gmail"
}
}
Why this matters: Allows you to process attachments in sub-workflows while retaining crucial file information.
Use Cases: Handling email attachments with file type, processing uploaded files with original context.
Tags: n8n
, subworkflow
, binary data
, attachments
, metadata transfer
, concurrent data
, file and data integration
, pass attachments
, sub-workflow input