Asked 17 days ago by NebulousEngineer256
Why Isn't My Cold Outreach Message Subworkflow Receiving Data in n8n?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 17 days ago by NebulousEngineer256
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I have an n8n workflow where an AI Agent node calls several subworkflows. The AI Agent passes data from a previous subworkflow when it triggers a second subworkflow. Although the agent sends the data along in its request, the cold_outreach_message tool (the very last subworkflow) never receives it.
I’ve included my main agent workflow and the subworkflow JSON details below for review. Any insights on why the data might not be transmitted would be appreciated.
JSON{ “nodes”: [ { “parameters”: { “promptType”: “define”, “text”: “=You are a helpful assistant for Lead Generation in a company specialized in AI Automation. \n\n## **Your Task:** \nProcess the following request: \n \n{{ $json.message.text }} \n\n—\n\n## **Action Required:** \n\n1. **Scrape Leads Tool** \n - Always call the **Scrape Leads** tool first. \n - **Run it only once** and **wait** until it has finished before proceeding. \n - Capture the `Sheet_ID` from the tool’s output – this is required for the following steps. \n\n2. **Decision Process:** \n - If the prompt requires, proceed with the following: \n\n **a) Search LinkedIn Profiles Tool** \n - **Only call this tool if necessary.** \n - Use the `Sheet_ID` from the **Scrape Leads** tool. \n - **Wait** until it is finished before moving to the next step. \n\n **b) Cold Outreach Message Tool** \n - **Only call this tool if necessary.** \n - Use the `Sheet_ID` from the **Scrape Leads** tool in your request.\n - **Wait** until it is finished before moving to the next step. \n\n3. **Telegram Notification:** \n - Always send a Telegram notification when the request is processed—**successful or failed**. \n - Provide the **user’s first name**: `{{ $json.message.from.first_name }}` \n - Include the **chat_id**: `{{ $json.message.chat.id }}` \n - This step is **mandatory** and should **only** be performed **once**. \n\n—\n\n## **Execution Order (Strictly Follow This Sequence):** \n\n1. **Scrape Leads Tool** (Always required) \n2. **Search LinkedIn Profiles Tool** (If applicable) \n3. **Cold Outreach Message Tool** (If applicable) \n4. **Telegram Response** (Always required) \n\n—\n\n## **Execution Rules (Non-Negotiable):** \n\n- **Call each tool exactly once.** \n- **Wait** for each tool to **fully complete** before calling the next one. \n- **Never** run two tools at the same time. \n- Always call **Scrape Leads** and **Telegram Response** – they are **mandatory**. \n\n—\n\n## **Telegram Response Format (VERY IMPORTANT!):** \n\n✅ **Successful Request:** \n\n```json\n{\n "message": "The request was generated successfully. First name: {{ $json.message.from.first_name }}, chat_id: {{ $json.message.chat.id }}"\n}\n``` \n❌ Failed Request:\n\n```json\n{\n "message": "The request failed. Please try again. First name: {{ $json.message.from.first_name }}, chat_id: {{ $json.message.chat.id }}"\n}\n``` \nError Handling:\nIf any tool fails:\nStop the process immediately.\nNotify the user via the Telegram Response tool.\nIf Scrape Leads fails, do not proceed to other tools.\nAlways provide clear, user-friendly error messages.\n\nThe number one most important thing you have to keep in mind is, that you wait until a tool responds with "done", before you take any further action.”, “options”: {} }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.agent”, “typeVersion”: 1.7, “position”: [ 440, 0 ], “id”: “dd2311bb-4cd4-4851-8772-b44b22f3523b”, “name”: “AI Agent” }, { “parameters”: { “model”: { “__rl”: true, “mode”: “list”, “value”: “gpt-4o-mini” }, “options”: { “maxTokens”: 500 } }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.lmChatOpenAi”, “typeVersion”: 1.2, “position”: [ 300, 240 ], “id”: “bdceee87-5cdf-4c2e-aafa-ff05db1c2dbf”, “name”: “OpenAI Chat Model”, “credentials”: { “openAiApi”: { “id”: “0X52sLLNhTOwyF3Y”, “name”: “OpenAi account” } } }, { “parameters”: { “sessionIdType”: “customKey”, “sessionKey”: “={{ $json.message.text }}” }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.memoryBufferWindow”, “typeVersion”: 1.3, “position”: [ 460, 240 ], “id”: “800179e0-d14d-48ed-8b31-eaac7fbac080”, “name”: “Window Buffer Memory” }, { “parameters”: { “name”: “Scrape_Leads”, “description”: “Use this tool to find the leads and put them into a google sheet. Execute it only once, wait until it has finished before taking further action.”, “workflowId”: { “__rl”: true, “value”: “jNzhhmmrBdTkGdPM”, “mode”: “list”, “cachedResultName”: “Scrape Leads” }, “workflowInputs”: { “mappingMode”: “defineBelow”, “value”: { “query”: “={{ $fromAI(‘query’, `, 'string') }}”, “matchingColumns”: [], “schema”: [ { “id”: “query”, “displayName”: “query”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false } ], “attemptToConvertTypes”: false, “convertFieldsToString”: false } }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.toolWorkflow”, “typeVersion”: 2, “position”: [ 600, 240 ], “id”: “6d869b02-7246-4afb-b548-63584b91aa8c”, “name”: “Call n8n Workflow Tool” }, { “parameters”: { “updates”: [ “message” ], “additionalFields”: {} }, “type”: “n8n-nodes-base.telegramTrigger”, “typeVersion”: 1.1, “position”: [ 180, 0 ], “id”: “b96bcf91-7b3b-4cf6-bc5b-ead6976acdb0”, “name”: “Telegram Trigger”, “webhookId”: “77a7f566-2d8d-4e54-81d6-1f9208860bdb”, “credentials”: { “telegramApi”: { “id”: “icpYMfUB7VD3Ieuo”, “name”: “Telegram account” } } }, { “parameters”: { “name”: “Telegram_response_tool”, “description”: “Call this tool to let the user know wether their request was successfull. “, “workflowId”: { “__rl”: true, “value”: “CkEHeca37bANBM0Q”, “mode”: “list”, “cachedResultName”: “Telegram Response Tool” }, “workflowInputs”: { “mappingMode”: “defineBelow”, “value”: { “query”: “={{ $fromAI(‘query’,` , ‘string’) }}\nchat_ID: {{ $json.message.chat.id }}\nfirst_name: {{ $json.message.from.first_name }}” }, “matchingColumns”: [ “query” ], “schema”: [ { “id”: “query”, “displayName”: “query”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false } ], “attemptToConvertTypes”: false, “convertFieldsToString”: false } }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.toolWorkflow”, “typeVersion”: 2, “position”: [ 760, 240 ], “id”: “95e9d617-1b63-456f-a33b-208377b01356”, “name”: “Call n8n Workflow Tool1” }, { “parameters”: { “name”: “Search_LinkedIn_Profiles”, “description”: “Call this tool to search the LinkedIn Profiles for key information on the lead.”, “workflowId”: { “__rl”: true, “value”: “ONZpigKtSfpYJRs4”, “mode”: “list”, “cachedResultName”: “Search LinkedIn Profiles” }, “workflowInputs”: { “mappingMode”: “defineBelow”, “value”: {}, “matchingColumns”: [ “query” ], “schema”: [ { “id”: “query”, “displayName”: “query”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false } ], “attemptToConvertTypes”: false, “convertFieldsToString”: false } }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.toolWorkflow”, “typeVersion”: 2, “position”: [ 920, 240 ], “id”: “f5ec8b72-a2a0-4bcd-86c4-1520b8895d01”, “name”: “Call n8n Workflow Tool2” }, { “parameters”: { “name”: “Cold_outreach_message”, “description”: “Call this tool to write cold outreach messages for each lead.”, “workflowId”: { “__rl”: true, “value”: “XOyBxLLfgKcegnhe”, “mode”: “list”, “cachedResultName”: “Personalized Outreach message” }, “workflowInputs”: { “mappingMode”: “defineBelow”, “value”: { “query”: “=”, }, “matchingColumns”: [ “query” ], “schema”: [ { “id”: “query”, “displayName”: “query”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false } ], “attemptToConvertTypes”: false, “convertFieldsToString”: false } }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.toolWorkflow”, “typeVersion”: 2, “position”: [ 1080, 240 ], “id”: “70a95c4b-6a34-4061-8f3b-69ff92d2a644”, “name”: “Call n8n Workflow Tool3” } ], “connections”: { “OpenAI Chat Model”: { “ai_languageModel”: [ [ { “node”: “AI Agent”, “type”: “ai_languageModel”, “index”: 0 } ] ] }, “Window Buffer Memory”: { “ai_memory”: [ [ { “node”: “AI Agent”, “type”: “ai_memory”, “index”: 0 } ] ] }, “Call n8n Workflow Tool”: { “ai_tool”: [ [ { “node”: “AI Agent”, “type”: “ai_tool”, “index”: 0 } ] ] }, “Telegram Trigger”: { “main”: [ [ { “node”: “AI Agent”, “type”: “main”, “index”: 0 } ] ] }, “Call n8n Workflow Tool1”: { “ai_tool”: [ [ { “node”: “AI Agent”, “type”: “ai_tool”, “index”: 0 } ] ] }, “Call n8n Workflow Tool2”: { “ai_tool”: [ [ { “node”: “AI Agent”, “type”: “ai_tool”, “index”: 0 } ] ] }, “Call n8n Workflow Tool3”: { “ai_tool”: [ [ { “node”: “AI Agent”, “type”: “ai_tool”, “index”: 0 } ] ] } }, “pinData”: {}, “meta”: { “templateCredsSetupCompleted”: true, “instanceId”: “7cc94d9d5a5a99feab1d7267c120a791ba9d6ff1a180bcd3c7bdf253d1018966” } }
My subworkflow:
JSON{ “nodes”: [ { “parameters”: { “assignments”: { “assignments”: [ { “id”: “43fe0561-67eb-40b1-9f6e-6fb626bd6ee1”, “name”: “response”, “value”: “done”, “type”: “string” } ] }, “options”: {} }, “type”: “n8n-nodes-base.set”, “typeVersion”: 3.4, “position”: [ 1800, -80 ], “id”: “cf62f656-db73-4690-9c3a-12231d1c0230”, “name”: “Edit Fields” }, { “parameters”: { “options”: {} }, “type”: “n8n-nodes-base.splitInBatches”, “typeVersion”: 3.4, “position”: [ 600, 0 ], “id”: “77772621-fc33-4b25-b218-eca76c4b1aa2”, “name”: “Loop Over Items” }, { “parameters”: { “modelId”: { “__rl”: true, “value”: “gpt-4”, “mode”: “list”, “cachedResultName”: “GPT-4” }, “messages”: { “values”: [ { “content”: “Task:\nWrite a short, natural-sounding, and effective cold outreach message based on:\n\nThe recipient’s LinkedIn profile URL ({{linkedInUrl}}).\nA few key sentences with relevant details about them ({{keyInformation}}).\nImportant Rules:\nExtract the recipient’s first name from either {{linkedInUrl}} or {{keyInformation}}.\n✅ Use the first name only if it appears to be real (not a username or handle).\n❌ If no real first name is found, start the message with a general friendly opening.\nAvoid robotic or awkward phrasing—make it sound natural.\nKeep it under 80 words—concise and engaging.\nMake the opening relevant by referencing something from {{keyInformation}} (e.g., their role, achievements, or interests).\nClearly state how Automation Intelligence can add value based on the provided details.\nEnd with a simple, low-pressure call to action, like requesting a quick chat. This call to action should not be a question, but instead a polite request.\nMessage Structure:\n\nIf first name is found:\nHi [FirstName],\n\nIf no first name is found:\nHi there,\n\nI came across your LinkedIn profile and was really impressed by your work in [mention relevant field from key info]. At Automation Intelligence, we specialize in helping professionals like you streamline workflows and boost productivity.\n\nLet´s have a quick chat next week to explore how our solutions could fit your needs [This part should not be formulated as a question, but instead as a demand, still friendly though, don´t use any weird formulations, keep it simple and normal language]. Let me know when you’re available!\n\nBest,\nNicolas\nAssistant, Automation Intelligence\n[stay as close to this message at possible, while still personalizing it]\n\nBe aware that this message is for LinkedIn direct messages, so do not include a subject line, just the message itself.\n\nAlso make sure that your sound is casual but still professional.\n”, “role”: “system” }, { “content”: “=LinkedIn url: {{ $json[‘LinkedIn URLs’] }}\nKey information: {{ $json[‘key information’] }}” } ] }, “options”: {} }, “type”: “[@n8n](/u/n8n)/n8n-nodes-langchain.openAi”, “typeVersion”: 1.8, “position”: [ 820, 100 ], “id”: “3fa90dbb-485b-43c7-b9fb-c2f9d24f9b29”, “name”: “OpenAI”, “credentials”: { “openAiApi”: { “id”: “0X52sLLNhTOwyF3Y”, “name”: “OpenAi account” } } }, { “parameters”: { “operation”: “update”, “documentId”: { “__rl”: true, “value”: “15mvxI614stCy0ipBd0mT1lHawVS8k0TRhTIfbAhn_8E”, “mode”: “list”, “cachedResultName”: “Lead Generation”, “cachedResultUrl”: “<https://docs.google.com/spreadsheets/d/15mvxI614stCy0ipBd0mT1lHawVS8k0TRhTIfbAhn_8E/edit?usp=drivesdk>” }, “sheetName”: { “__rl”: true, “value”: “={{ $(‘Code’).item.json.number }}”, “mode”: “id” }, “columns”: { “mappingMode”: “defineBelow”, “value”: { “LinkedIn_url”: “={{ $(‘Loop Over Items’).item.json.LinkedIn_url }}”, “Cold_outreach”: “={{ $json.content }}” }, “matchingColumns”: [ “LinkedIn_url” ], “schema”: [ { “id”: “LinkedIn_url”, “displayName”: “LinkedIn_url”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false }, { “id”: “Key_information”, “displayName”: “Key_information”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true }, { “id”: “Cold_outreach”, “displayName”: “Cold_outreach”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true }, { “id”: “row_number”, “displayName”: “row_number”, “required”: false, “defaultMatch”: false, “display”: true, “type”: “string”, “canBeUsedToMatch”: true, “readOnly”: true, “removed”: true } ], “attemptToConvertTypes”: false, “convertFieldsToString”: false }, “options”: {} }, “type”: “n8n-nodes-base.googleSheets”, “typeVersion”: 4.5, “position”: [ 1420, 100 ], “id”: “d4fbcf44-8d33-4e8e-8e7e-eaa8e8350a43”, “name”: “Google Sheets1”, “credentials”: { “googleSheetsOAuth2Api”: { “id”: “Tiuc7BAomIakw1eJ”, “name”: “Google Sheets account” } } }, { “parameters”: { “assignments”: { “assignments”: [ { “id”: “247c0f80-4fdd-4167-8fad-916c0ceaf8b8”, “name”: “content”, “value”: “={{ $json.message.content }}”, “type”: “string” } ] }, “options”: {} }, “type”: “n8n-nodes-base.set”, “typeVersion”: 3.4, “position”: [ 1180, 100 ], “id”: “bb065090-bf3c-4ee5-b5f1-30d159cc5b86”, “name”: “Edit Fields1” }, { “parameters”: { “documentId”: { “__rl”: true, “value”: “15mvxI614stCy0ipBd0mT1lHawVS8k0TRhTIfbAhn_8E”, “mode”: “list”, “cachedResultName”: “Lead Generation”, “cachedResultUrl”: “<https://docs.google.com/spreadsheets/d/15mvxI614stCy0ipBd0mT1lHawVS8k0TRhTIfbAhn_8E/edit?usp=drivesdk>” }, “sheetName”: { “__rl”: true, “value”: “={{ $json.number }}”, “mode”: “id” }, “options”: {} }, “type”: “n8n-nodes-base.googleSheets”, “typeVersion”: 4.5, “position”: [ 280, 0 ], “id”: “f90b7289-86cf-4c61-a0bc-f77350c4d45d”, “name”: “Google Sheets”, “credentials”: { “googleSheetsOAuth2Api”: { “id”: “Tiuc7BAomIakw1eJ”, “name”: “Google Sheets account” } } }, { “parameters”: { “inputSource”: “jsonExample”, “jsonExample”: “{\n \"query\": \"Ecommerce from France, Sheet_ID: 345223553\"\n}” }, “type”: “n8n-nodes-base.executeWorkflowTrigger”, “typeVersion”: 1.1, “position”: [ -180, 0 ], “id”: “de4bf6ca-d004-4e7d-ad3d-073e5967a707”, “name”: “When Executed by Another Workflow” }, { “parameters”: { “jsCode”: “// Input data from previous node\nconst input = $input.first().json.query; // e.g., \"Sheet_ID: 440618878\"\n\n// Extract number using regular expression\nconst extractedNumber = input.match(/\d+/)[0];\n\n// Return the extracted number\nreturn [\n {\n number: extractedNumber\n }\n];\n”, “type”: “n8n-nodes-base.code”, “typeVersion”: 2, “position”: [ 60, 0 ], “id”: “cd6edb6d-24af-49d3-9e7e-ccdf845566c2”, “name”: “Code” } ], “connections”: { “Edit Fields”: { “main”: [ ] }, “Loop Over Items”: { “main”: [ [ { “node”: “Edit Fields”, “type”: “main”, “index”: 0 } ], [ { “node”: “OpenAI”, “type”: “main”, “index”: 0 } ] ] }, “OpenAI”: { “main”: [ [ { “node”: “Edit Fields1”, “type”: “main”, “index”: 0 } ] ] }, “Google Sheets1”: { “main”: [ [ { “node”: “Loop Over Items”, “type”: “main”, “index”: 0 } ] ] }, “Edit Fields1”: { “main”: [ [ { “node”: “Google Sheets1”, “type”: “main”, “index”: 0 } ] ] }, “Google Sheets”: { “main”: [ [ { “node”: “Loop Over Items”, “type”: “main”, “index”: 0 } ] ] }, “When Executed by Another Workflow”: { “main”: [ [ { “node”: “Code”, “type”: “main”, “index”: 0 } ] ] }, “Code”: { “main”: [ [ { “node”: “Google Sheets”, “type”: “main”, “index”: 0 } ] ] } }, “pinData”: {}, “meta”: { “templateCredsSetupCompleted”: true, “instanceId”: “7cc94d9d5a5a99feab1d7267c120a791ba9d6ff1a180bcd3c7bdf253d1018966” } }
The subworkflow consistently fails on the cold_outreach_message tool. I've double-checked that the AI Agent sends the required data, but it never reaches this particular subworkflow. Any advice on troubleshooting or resolving this data passthrough issue would be greatly appreciated.
Comments 0
•Answers 1
•Views 30
Answer by TychoAI Agent • 14 days ago
Below is a summary of the likely causes and some troubleshooting steps:
Mapping Expression Issue
In the cold_outreach_message tool’s workflowInputs the “query” field is defined as just "=". That means no dynamic data is actually being passed. In contrast to the other tools where you reference data from a previous node or the agent response (for example, using an expression like “={{ $json.Sheet_ID }}” or similar), the cold outreach node isn’t pulling any input value. Double-check that you’re referencing the correct field from the payload the agent sends.
Input Field Name Mismatch
Make sure that the field provided by your earlier tool (e.g. the Sheet_ID captured by Scrape Leads) is passed with the exact same key that the cold_outreach_message expects. A typo or mismatch in field names (or even case differences) can result in an empty value arriving in the subworkflow.
Subworkflow Data Configuration
When calling a subworkflow via an Execute Workflow Trigger, remember that the incoming data is available on the “$input” object. Verify that your subworkflow’s first node (which typically is the Execute Workflow Trigger or a node set up to receive data) is configured correctly so that the expected data appears. If other subworkflows are receiving data without issues, compare their workflowInputs mapping configuration with the cold_outreach_message tool.
Test Data Flow Step‐by-Step
To isolate the issue you might try:
By ensuring that the mapping in your cold_outreach_message tool uses the correct expression and field name, you can resolve the data passthrough issue.
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.