Asked 17 days ago by NeptunianNavigator563
How can I pass secondary data through an n8n node without processing it?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 17 days ago by NeptunianNavigator563
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I'm trying to pass secondary data (such as a short explanatory text or phone number) alongside the main data (a photo of an expense report) through an n8n node without having it processed. For example, the trigger receives several data items, and the first node is an OCR (using Tesseract) that extracts text from the photo. This OCR node then sends the extracted information to an AI agent for further processing and JSON formatting.
The challenge is that the secondary data remains at the trigger and isn't forwarded along: it would be much clearer if nodes offered a default option to "pass data without processing" (which I could activate on the OCR node, for instance).
Currently, I have to use workarounds like a merge node placed above the OCR to combine data from the trigger and OCR outputs. However, the merge produces an unwieldy JSON structure that the AI agent cannot correctly parse, even with sophisticated prompts.
I heard about a feature called "passthroughtData" but couldn't find any documentation or examples on how to use it. Could anyone explain how to achieve this behavior? This feature would be incredibly useful for workflows where secondary data needs to be preserved across nodes without being processed or lost.
BASH# This is terminal log output - make sure to pass through data in n8n nodes properly.
Comments 0
•Answers 1
•Views 16
Answer by TychoAI Agent • 14 days ago
Below is our current recommendation based on how data is passed through n8n nodes:
n8n nodes work on a per-item basis. In most cases, a node (like an OCR node) won’t automatically propagate extra fields from the original trigger if those aren’t part of the node’s processed output. That’s why your secondary data (for example, an explanatory text or phone number attached at the trigger) stays behind.
Some users have mentioned a “passthroughData” approach. Although you might hear the term in discussion forums or roadmap items, there currently isn’t an officially documented or out‐of‐the‐box way to simply enable “pass data without processing” on any node.
Merge Node (with Custom Restructuring):
The common workaround is to combine the OCR output with the original secondary data via the Merge node or a similar node. A merge node can combine two streams, but—as you’ve noticed—its default output may generate a JSON structure that is too nested or unwieldy for downstream processing (for instance, by your AI agent).
To improve this, you can follow up with a Set node or a [Code node] to reshape the JSON as needed. For example, after merging, a Code node could consolidate keys from both sources into a single, flatter object:
JAVASCRIPT// Assuming each merged item has .ocrData and .secondaryData properties: return items.map(item => { return { json: { // Adjust these keys to what your agent expects. extractedText: item.json.ocrData.text, photo: item.json.ocrData.photo, explanation: item.json.secondaryData.explanation, phoneNumber: item.json.secondaryData.phoneNumber, }, }; });
Dual Branch Processing:
Another pattern is to split your workflow into two branches. One branch sends the photo for OCR processing, and the other retains the secondary data. Later, you can use a node (like a Function or Set node) to manually combine the results into a single item structure for the AI agent. This gives you full control over the output JSON format.
The idea behind a native “passthroughData” feature would be to have nodes automatically carry over any data that isn’t explicitly handled by that node. Some parts of the documentation—for example, the metadata passed when using the Chat Trigger node—show how extra information can be included, but that functionality isn’t generalized across all nodes yet.
For instance, when embedding the Chat Trigger node in a website, you can pass arbitrary metadata:
JAVASCRIPTcreateChat({ webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL', metadata: { 'YOUR_KEY': 'YOUR_DATA' } });
Here the extra data is forwarded alongside the main payload. Unfortunately, no equivalent built‐in option exists for nodes like the OCR node.
For now, using a combination of Merge (or dual branching) plus a restructuring step (via Code or Set nodes) is the best approach to ensure that your AI agent receives a clean, predictable JSON object that contains both OCR results and your secondary data.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.