This workflow corresponds to n8n.io template #16577 — we link there as the canonical source.
This workflow follows the Agent → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "zLD25nCNDzJ6GHJw",
"name": "AI Lead Enrichment Pipeline - Company Research on Autopilot (Tavily + Groq)",
"tags": [],
"nodes": [
{
"id": "5d895882-b7f1-43b5-8b2d-8432ea49795b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"width": 480,
"height": 896,
"content": "## AI Lead Enrichment Pipeline - Company Research on Autopilot (Tavily + Groq)\n\n### How it works\n\nThis workflow receives a company name and domain via webhook, normalizes the input, and runs a sequence of Tavily searches to collect company information, recent news, and key people. It passes the gathered research to a Groq-powered AI agent to produce a structured lead profile, then parses and validates the response. Valid profiles are saved to Google Sheets and returned to the webhook caller, while parsing failures return an error response.\n\n### Setup steps\n\n- Configure the Webhook Trigger URL and ensure callers send the expected company and domain fields.\n- Add a Tavily API key to each HTTP Request node that posts to https://api.tavily.com/search, typically through headers or credentials as configured in the nodes.\n- Configure Groq credentials for the Groq LLM sub-node used by the AI Lead Analyst agent.\n- Connect Google Sheets credentials and select the target spreadsheet, sheet, and columns for the enriched lead profile.\n- Verify the AI output format expected by the Parse & Flatten code node so the Parse OK? branch can correctly validate successful results.\n\n### Customization\n\nAdjust the Tavily search queries to target different research angles, change the AI agent prompt to produce different enrichment fields, or update the Google Sheets mapping to match your CRM or lead scoring schema."
},
"typeVersion": 1
},
{
"id": "0f6db7d9-f229-42af-be22-b990cf4650c1",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
560,
176
],
"parameters": {
"color": "#ECA7A7",
"width": 432,
"height": 320,
"content": "## Receive lead input\n\nWebhook entry point and input normalization cluster that prepares the company and domain values for downstream research."
},
"typeVersion": 1
},
{
"id": "e608dbb2-af49-4858-84f4-92b33619605e",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
0
],
"parameters": {
"color": 2,
"width": 448,
"height": 336,
"content": "## Fetch company profile\n\nRuns the first Tavily search for general company information and stores the results alongside the normalized company and domain fields."
},
"typeVersion": 1
},
{
"id": "5084a321-54a0-49a6-a318-16c751bdd8d7",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1584,
16
],
"parameters": {
"color": 4,
"width": 448,
"height": 320,
"content": "## Fetch recent news\n\nUses Tavily to gather recent company news, then stores that news while preserving the previously collected company context."
},
"typeVersion": 1
},
{
"id": "f90fa92e-8e17-4854-9a3f-6c8fad25267f",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
2112,
0
],
"parameters": {
"width": 448,
"height": 320,
"content": "## Fetch key people\n\nSearches for key people associated with the company and stores the people data with the accumulated research payload."
},
"typeVersion": 1
},
{
"id": "15f89e4e-5007-4632-83a5-42a6c8af3f33",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1696,
368
],
"parameters": {
"color": 6,
"width": 352,
"height": 640,
"content": "## Analyze lead with AI\n\nAI analysis cluster where the lead research is interpreted by the AI Lead Analyst using the Groq chat model sub-node."
},
"typeVersion": 1
},
{
"id": "7e948ca7-58ba-442f-94f8-6a0f3a933663",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
2064,
368
],
"parameters": {
"color": 4,
"width": 448,
"height": 320,
"content": "## Parse and validate result\n\nTransforms the AI output into flattened structured data and checks whether parsing succeeded before routing to success or error handling."
},
"typeVersion": 1
},
{
"id": "bd85a2c2-fbad-469c-aa27-3375838f388d",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2592,
208
],
"parameters": {
"color": 6,
"width": 448,
"height": 592,
"content": "## Save and respond\n\nFinal response cluster that saves valid lead profiles to Google Sheets and returns them to the webhook caller, or returns an error response when validation fails."
},
"typeVersion": 1
},
{
"id": "87db9151-d524-4f16-b3ac-5d0b01811a67",
"name": "When Lead Enrichment Initiated",
"type": "n8n-nodes-base.webhook",
"position": [
608,
336
],
"parameters": {
"path": "enrich-lead",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "46af9cd6-a825-42f3-89e3-10deafd1dfd5",
"name": "Set Company Details",
"type": "n8n-nodes-base.set",
"position": [
848,
336
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "company-name",
"name": "company",
"type": "string",
"value": "={{ $json.body.company }}"
},
{
"id": "domain-field",
"name": "domain",
"type": "string",
"value": "={{ $json.body.domain || '' }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ec5e5006-3128-4260-9384-822a4ec38b5a",
"name": "Capture Company Information",
"type": "n8n-nodes-base.set",
"position": [
1376,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "company-info-data",
"name": "company_info",
"type": "string",
"value": "={{ JSON.stringify($json) }}"
},
{
"id": "carry-company",
"name": "company",
"type": "string",
"value": "={{ $('Set Company Details').item.json.company }}"
},
{
"id": "carry-domain",
"name": "domain",
"type": "string",
"value": "={{ $('Set Company Details').item.json.domain }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "938dfbc7-30ae-4512-84e9-8cd43c53ad43",
"name": "Capture Recent News Data",
"type": "n8n-nodes-base.set",
"position": [
1888,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "news-data",
"name": "recent_news",
"type": "string",
"value": "={{ JSON.stringify($json) }}"
},
{
"id": "carry-info",
"name": "company_info",
"type": "string",
"value": "={{ $('Capture Company Information').item.json.company_info }}"
},
{
"id": "carry-company2",
"name": "company",
"type": "string",
"value": "={{ $('Capture Company Information').item.json.company }}"
},
{
"id": "carry-domain2",
"name": "domain",
"type": "string",
"value": "={{ $('Capture Company Information').item.json.domain }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "61a15ede-4e5a-416a-9889-a6c88febbc14",
"name": "Capture Key People Data",
"type": "n8n-nodes-base.set",
"position": [
2416,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "people-data",
"name": "key_people",
"type": "string",
"value": "={{ JSON.stringify($json) }}"
},
{
"id": "carry-info2",
"name": "company_info",
"type": "string",
"value": "={{ $('Capture Recent News Data').item.json.company_info }}"
},
{
"id": "carry-news",
"name": "recent_news",
"type": "string",
"value": "={{ $('Capture Recent News Data').item.json.recent_news }}"
},
{
"id": "carry-company3",
"name": "company",
"type": "string",
"value": "={{ $('Capture Recent News Data').item.json.company }}"
},
{
"id": "carry-domain3",
"name": "domain",
"type": "string",
"value": "={{ $('Capture Recent News Data').item.json.domain }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "987bad17-89fc-4302-a056-e9e287015038",
"name": "AI Lead Analysis Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1728,
528
],
"parameters": {
"text": "=Create a comprehensive lead enrichment profile for: {{ $json.company }}\n\nDomain: {{ $json.domain }}\n\nCOMPANY SEARCH RESULTS:\n{{ $json.company_info }}\n\nRECENT NEWS SEARCH RESULTS:\n{{ $json.recent_news }}\n\nKEY PEOPLE SEARCH RESULTS:\n{{ $json.key_people }}\n\nSynthesize all search results into a structured lead profile. Respond ONLY with valid JSON.",
"options": {
"maxIterations": 5,
"systemMessage": "You are an expert B2B sales intelligence analyst. Your job is to synthesize raw search results into a clean, actionable lead enrichment profile that a sales team can use for outreach.\n\nYou MUST respond ONLY with valid JSON. No markdown, no code blocks, no extra text.\n\nRequired JSON structure:\n{\n \"company_name\": \"Official company name\",\n \"domain\": \"company website domain\",\n \"tagline\": \"One-line description of what they do\",\n \"industry\": \"Primary industry\",\n \"sub_industry\": \"Specific niche within the industry\",\n \"founded\": \"Year founded or 'Unknown'\",\n \"headquarters\": \"City, Country\",\n \"company_size\": \"Estimated employee count range (e.g. '50-200') or 'Unknown'\",\n \"funding_stage\": \"Bootstrapped/Seed/Series A/B/C/Public/Unknown\",\n \"estimated_revenue\": \"Revenue range if available, else 'Unknown'\",\n \"products_services\": [\n \"Product/Service 1\",\n \"Product/Service 2\",\n \"Product/Service 3\"\n ],\n \"tech_stack_signals\": [\n \"Technology or platform they likely use based on their industry and products\"\n ],\n \"key_people\": [\n {\n \"name\": \"Person's full name\",\n \"title\": \"Their role/title\",\n \"relevance\": \"Why this person matters for outreach\"\n }\n ],\n \"recent_news\": [\n {\n \"headline\": \"News headline or summary\",\n \"date\": \"Approximate date or 'Recent'\",\n \"significance\": \"Why this matters for a sales conversation\"\n }\n ],\n \"pain_points\": [\n \"Likely pain point 1 based on industry and company profile\",\n \"Likely pain point 2\",\n \"Likely pain point 3\"\n ],\n \"outreach_angles\": [\n {\n \"angle\": \"Specific outreach angle\",\n \"opening_line\": \"Suggested first line for a cold email using this angle\"\n },\n {\n \"angle\": \"Second outreach angle\",\n \"opening_line\": \"Another cold email opening\"\n }\n ],\n \"icp_fit_score\": \"High/Medium/Low \u2014 how likely is this a real company with purchasing power\",\n \"enrichment_confidence\": \"High/Medium/Low \u2014 how much data was available\",\n \"data_gaps\": [\"What information is missing or uncertain\"]\n}\n\nRules:\n- ONLY include information found in the search results \u2014 never fabricate company details\n- If data is unavailable, explicitly mark it as 'Unknown' \u2014 don't guess\n- Pain points should be industry-informed, not generic\n- Outreach angles must reference specific company details (news, product, funding)\n- Opening lines should feel personalized, not templated\n- If the company doesn't appear to exist, set enrichment_confidence to 'Low' and note in data_gaps"
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "b5beae72-db1f-4232-a8b9-304aac839c14",
"name": "Groq Language Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"position": [
1728,
864
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {
"temperature": 0.4,
"maxTokensToSample": 4096
}
},
"typeVersion": 1
},
{
"id": "d4227da7-2b24-4b11-a93f-c84fa2f526c4",
"name": "Flatten Response Data",
"type": "n8n-nodes-base.code",
"position": [
2112,
528
],
"parameters": {
"jsCode": "const items = $input.all();\nconst output = items[0].json.output;\n\nlet parsed;\ntry {\n parsed = JSON.parse(output);\n} catch (e) {\n const jsonMatch = output.match(/```(?:json)?\\s*([\\s\\S]*?)```/);\n if (jsonMatch) {\n try { parsed = JSON.parse(jsonMatch[1].trim()); } catch (e2) { parsed = null; }\n }\n if (!parsed) {\n const objMatch = output.match(/\\{[\\s\\S]*\\}/);\n if (objMatch) {\n try { parsed = JSON.parse(objMatch[0]); } catch (e3) { parsed = null; }\n }\n }\n}\n\nif (!parsed) {\n return [{ json: { parse_status: 'failed', error: 'Could not parse lead profile from AI response', raw_output: output } }];\n}\n\n// Flatten for Google Sheets\nreturn [{\n json: {\n parse_status: 'success',\n timestamp: new Date().toISOString(),\n company_name: parsed.company_name || '',\n domain: parsed.domain || '',\n tagline: parsed.tagline || '',\n industry: parsed.industry || '',\n sub_industry: parsed.sub_industry || '',\n founded: parsed.founded || '',\n headquarters: parsed.headquarters || '',\n company_size: parsed.company_size || '',\n funding_stage: parsed.funding_stage || '',\n estimated_revenue: parsed.estimated_revenue || '',\n products_services: Array.isArray(parsed.products_services) ? parsed.products_services.join(', ') : '',\n tech_stack: Array.isArray(parsed.tech_stack_signals) ? parsed.tech_stack_signals.join(', ') : '',\n key_people: Array.isArray(parsed.key_people) ? parsed.key_people.map(p => p.name + ' (' + p.title + ')').join(', ') : '',\n recent_news: Array.isArray(parsed.recent_news) ? parsed.recent_news.map(n => n.headline).join(' | ') : '',\n pain_points: Array.isArray(parsed.pain_points) ? parsed.pain_points.join(', ') : '',\n outreach_angle_1: parsed.outreach_angles?.[0]?.angle || '',\n opening_line_1: parsed.outreach_angles?.[0]?.opening_line || '',\n outreach_angle_2: parsed.outreach_angles?.[1]?.angle || '',\n opening_line_2: parsed.outreach_angles?.[1]?.opening_line || '',\n icp_fit_score: parsed.icp_fit_score || '',\n enrichment_confidence: parsed.enrichment_confidence || '',\n data_gaps: Array.isArray(parsed.data_gaps) ? parsed.data_gaps.join(', ') : '',\n full_profile_json: JSON.stringify(parsed)\n }\n}];"
},
"typeVersion": 2
},
{
"id": "2249cc87-dc93-4044-aace-109ed3925ac8",
"name": "Check Parse Status",
"type": "n8n-nodes-base.if",
"position": [
2368,
528
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "parse-ok",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.parse_status }}",
"rightValue": "success"
}
]
}
},
"typeVersion": 2
},
{
"id": "091265fe-5978-40f6-8b3f-dcc88bedd1bf",
"name": "Respond with Lead Profile",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
2896,
384
],
"parameters": {
"options": {},
"respondWith": "allIncomingItems"
},
"typeVersion": 1.1
},
{
"id": "0563b31c-e479-4a06-8f72-18cd8a12b8f9",
"name": "Append Lead to Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
2640,
384
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"mode": "name",
"value": "Leads"
},
"documentId": {
"mode": "id",
"value": "YOUR_GOOGLE_SHEET_ID"
}
},
"typeVersion": 4.5
},
{
"id": "04600a8d-2bcb-4012-9b46-b793abc5d727",
"name": "Respond with Error",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
2640,
640
],
"parameters": {
"options": {
"responseCode": 422
},
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ status: 'error', message: $json.error || 'Failed to generate lead profile. Try a different company name.', raw: $json.raw_output || '' }) }}"
},
"typeVersion": 1.1
},
{
"id": "e0d04d73-6588-4a9a-b699-5402a219b6b6",
"name": "Post Key People Search",
"type": "n8n-nodes-base.httpRequest",
"position": [
2160,
160
],
"parameters": {
"url": "https://api.tavily.com/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"api_key\": \"YOUR_TAVILY_API_KEY\",\n \"query\": \"{{ $json.company }} leadership team CEO founder CTO key people executives\",\n \"max_results\": 5,\n \"include_answer\": true\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "bf35dff4-8ced-4781-82b1-846e9cdf3244",
"name": "Post News Search",
"type": "n8n-nodes-base.httpRequest",
"position": [
1632,
160
],
"parameters": {
"url": "https://api.tavily.com/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"api_key\": \"YOUR_TAVILY_API_KEY\",\n \"query\": \"{{ $json.company }} recent news announcements funding partnerships 2025 2026\",\n \"max_results\": 5,\n \"include_answer\": true\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "e79b0012-a663-44a0-884e-97eec4ac12f2",
"name": "Post Company Info Search",
"type": "n8n-nodes-base.httpRequest",
"position": [
1120,
160
],
"parameters": {
"url": "https://api.tavily.com/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"api_key\": \"YOUR_TAVILY_API_KEY\",\n \"query\": \"{{ $json.company }} company overview what they do products services headquarters founded\",\n \"max_results\": 5,\n \"include_answer\": true\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "f983b8d4-2709-4d79-8b01-8614c66a3c24",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
3120,
-16
],
"parameters": {
"color": 5,
"width": 476,
"height": 1004,
"content": "## Customization & Scaling\n\n### Batch enrichment:\n1. Add a Google Sheets Trigger (on new row)\n2. Feed company names automatically\n3. Results write back to the same sheet- Drop 100 company names in a sheet, walk away, come back to enriched leads\n\n### Add more search dimensions:\nDuplicate a search node and add:\n- Competitor analysis: 'CompanyX competitors alternatives'\n- Job postings: 'CompanyX careers hiring' (reveals priorities)\n- Tech stack: 'CompanyX built with technologies'\n- Reviews: 'CompanyX glassdoor reviews culture'\n\n### Connect to outreach tools:\n- Instantly.ai API - auto-create cold email sequences\n- Lemlist - personalized email campaigns\n- HubSpot - create/update contacts\n- Slack - notify sales team of enriched leads\n\n### Improve for specific industries:\nEdit the AI Lead Analyst system prompt:\n- SaaS: 'Focus on ARR, churn, integrations'\n- E-commerce: 'Focus on GMV, platforms, fulfillment'\n- Agencies: 'Focus on client roster, case studies, specialization'\n\n### Switch search provider:\nReplace Tavily with:\n- SerpAPI (Google results, 100 free/month)\n- Brave Search API (free tier)\n- Perplexity API (better for synthesis)"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "7535d10c-2d3d-43bd-96ba-781205fd0a33",
"nodeGroups": [],
"connections": {
"Post News Search": {
"main": [
[
{
"node": "Capture Recent News Data",
"type": "main",
"index": 0
}
]
]
},
"Check Parse Status": {
"main": [
[
{
"node": "Append Lead to Sheets",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond with Error",
"type": "main",
"index": 0
}
]
]
},
"Groq Language Model": {
"ai_languageModel": [
[
{
"node": "AI Lead Analysis Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Set Company Details": {
"main": [
[
{
"node": "Post Company Info Search",
"type": "main",
"index": 0
}
]
]
},
"Append Lead to Sheets": {
"main": [
[
{
"node": "Respond with Lead Profile",
"type": "main",
"index": 0
}
]
]
},
"Flatten Response Data": {
"main": [
[
{
"node": "Check Parse Status",
"type": "main",
"index": 0
}
]
]
},
"AI Lead Analysis Agent": {
"main": [
[
{
"node": "Flatten Response Data",
"type": "main",
"index": 0
}
]
]
},
"Post Key People Search": {
"main": [
[
{
"node": "Capture Key People Data",
"type": "main",
"index": 0
}
]
]
},
"Capture Key People Data": {
"main": [
[
{
"node": "AI Lead Analysis Agent",
"type": "main",
"index": 0
}
]
]
},
"Capture Recent News Data": {
"main": [
[
{
"node": "Post Key People Search",
"type": "main",
"index": 0
}
]
]
},
"Post Company Info Search": {
"main": [
[
{
"node": "Capture Company Information",
"type": "main",
"index": 0
}
]
]
},
"Capture Company Information": {
"main": [
[
{
"node": "Post News Search",
"type": "main",
"index": 0
}
]
]
},
"When Lead Enrichment Initiated": {
"main": [
[
{
"node": "Set Company Details",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow receives a company name via webhook, runs three Tavily web searches (company info, recent news, and key people), uses Groq (Llama 3.3 70B) to synthesize a structured lead profile, optionally appends the results to Google Sheets, and returns the enriched profile in…
Source: https://n8n.io/workflows/16577/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow audits a submitted website URL by extracting on-page SEO signals from the HTML, pulling Google PageSpeed Insights scores, and using Groq (Llama 3.3 70B) to generate a scored SEO report,
This workflow receives Salesforce Quote events via a webhook, enriches them with Salesforce Opportunity and Account data, benchmarks the deal against historical outcomes stored in Google Sheets, uses
case 2 - curso n8n. Uses agent, lmChatGroq, memoryBufferWindow, toolCalculator. Webhook trigger; 15 nodes.
VEP WAPP. Uses openAi, lmChatOpenAi, toolCalculator, agent. Webhook trigger; 100 nodes.
⏺ 🚀 How it works