This workflow corresponds to n8n.io template #12712 — we link there as the canonical source.
This workflow follows the Agent → Gmail 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": "1hbilVbVUx21tgHt6130a",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Re-engage dormant leads with AI emails and trigger detection",
"tags": [
{
"id": "K6D3K6nP6k9TByzr",
"name": "sales-automation",
"createdAt": "2026-01-14T17:39:47.009Z",
"updatedAt": "2026-01-14T17:39:47.009Z"
},
{
"id": "2SnnL6kvLdsyRux5",
"name": "lead-reengagement",
"createdAt": "2026-01-14T17:39:47.009Z",
"updatedAt": "2026-01-14T17:39:47.009Z"
}
],
"nodes": [
{
"id": "4f880962-44d0-4420-a770-e2484d90be4d",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
2848,
2112
],
"parameters": {
"color": 5,
"width": 400,
"height": 636,
"content": "## How it works\nThis workflow automatically re-engages dormant leads by detecting trigger events and generating personalized outreach emails.\n\n1. **Schedule** - Runs weekly (every Monday by default)\n2. **CRM Data** - Pulls leads inactive for 90+ days from your CRM\n3. **Trigger Detection** - Checks Crunchbase (funding), NewsAPI (company news), and Hunter.io (leadership changes) in parallel\n4. **AI Email** - Claude generates a personalized re-engagement email based on the trigger event\n5. **Rep Notification** - Sends the draft to the assigned sales rep for review and approval\n\n## Setup steps\n1. Replace the **Load inactive leads (mock)** node with your real CRM integration (Salesforce, HubSpot, etc.)\n2. Add API credentials for trigger detection:\n - NewsAPI (free at newsapi.org)\n - Crunchbase (optional, paid)\n - Hunter.io (free tier available)\n3. Add your **Anthropic API** credentials for Claude\n4. Add your **Gmail OAuth** credentials\n5. Test with **Test workflow manually** node before enabling schedule"
},
"typeVersion": 1
},
{
"id": "a8c70f32-e03f-4af5-beed-2121ebe6a0ed",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
3520,
2192
],
"parameters": {
"color": 7,
"width": 280,
"height": 80,
"content": "**CRM Data**\nReplace mock data with your CRM (Salesforce, HubSpot, Pipedrive)"
},
"typeVersion": 1
},
{
"id": "b6655cb3-31e7-42ed-9b19-81b79d822a61",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
3904,
2000
],
"parameters": {
"color": 7,
"width": 320,
"height": 80,
"content": "**Trigger Detection**\nChecks funding, news, and leadership changes in parallel"
},
"typeVersion": 1
},
{
"id": "69cd8b89-5ff3-40f2-a80f-046708390450",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
4400,
2192
],
"parameters": {
"color": 7,
"width": 300,
"height": 80,
"content": "**AI Generation**\nClaude writes personalized re-engagement emails based on triggers"
},
"typeVersion": 1
},
{
"id": "86ee3b7b-b101-404f-9c55-2399ef4f2303",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
4736,
2192
],
"parameters": {
"color": 7,
"width": 300,
"height": 80,
"content": "**Email Output**\nFormats and sends draft to sales rep for approval"
},
"typeVersion": 1
},
{
"id": "0325568b-29ca-4020-a143-3420d048818e",
"name": "Weekly schedule trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
3344,
2304
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
1
]
}
]
}
},
"typeVersion": 1.2
},
{
"id": "a34ca0f0-a5b3-4b6f-89f1-b81ae2fb62ca",
"name": "Load inactive leads (mock)",
"type": "n8n-nodes-base.code",
"position": [
3552,
2304
],
"parameters": {
"jsCode": "// Mock CRM Data - Replace with actual CRM API call\n// To use real CRM: Replace this node with HTTP Request to Salesforce/HubSpot\n\nconst mockLeads = [\n {\n id: \"lead_001\",\n company: \"TechNova Solutions\",\n contact_name: \"Sarah Chen\",\n contact_email: \"user@example.com\",\n title: \"VP of Sales\",\n status: \"Closed-Lost\",\n last_activity_date: \"2024-08-15\",\n industry: \"SaaS\",\n company_size: \"50-200\",\n assigned_rep: \"user@example.com\",\n original_opportunity_value: 45000,\n loss_reason: \"Budget constraints\"\n },\n {\n id: \"lead_002\",\n company: \"DataFlow Analytics\",\n contact_name: \"Marcus Johnson\",\n contact_email: \"user@example.com\",\n title: \"Director of Operations\",\n status: \"No Response\",\n last_activity_date: \"2024-07-22\",\n industry: \"Data Analytics\",\n company_size: \"200-500\",\n assigned_rep: \"user@example.com\",\n original_opportunity_value: 78000,\n loss_reason: \"Went dark after demo\"\n },\n {\n id: \"lead_003\",\n company: \"CloudFirst Inc\",\n contact_name: \"Amanda Rodriguez\",\n contact_email: \"user@example.com\",\n title: \"Chief Revenue Officer\",\n status: \"Closed-Lost\",\n last_activity_date: \"2024-06-10\",\n industry: \"Cloud Infrastructure\",\n company_size: \"500-1000\",\n assigned_rep: \"user@example.com\",\n original_opportunity_value: 125000,\n loss_reason: \"Chose competitor\"\n },\n {\n id: \"lead_004\",\n company: \"GreenLeaf Retail\",\n contact_name: \"David Park\",\n contact_email: \"user@example.com\",\n title: \"Head of Digital\",\n status: \"No Response\",\n last_activity_date: \"2024-09-01\",\n industry: \"E-commerce\",\n company_size: \"100-200\",\n assigned_rep: \"user@example.com\",\n original_opportunity_value: 32000,\n loss_reason: \"No response to follow-ups\"\n },\n {\n id: \"lead_005\",\n company: \"FinServe Global\",\n contact_name: \"Rachel Thompson\",\n contact_email: \"user@example.com\",\n title: \"VP of Technology\",\n status: \"Closed-Lost\",\n last_activity_date: \"2024-05-18\",\n industry: \"Financial Services\",\n company_size: \"1000+\",\n assigned_rep: \"user@example.com\",\n original_opportunity_value: 250000,\n loss_reason: \"Timing not right\"\n }\n];\n\nreturn mockLeads.map(lead => ({ json: lead }));"
},
"typeVersion": 2
},
{
"id": "0b604ef2-4a00-4754-9990-a2ed0693cad0",
"name": "Filter dormant leads (90+ days)",
"type": "n8n-nodes-base.code",
"position": [
3776,
2304
],
"parameters": {
"jsCode": "// Filter leads inactive for 90+ days\nconst today = new Date();\nconst ninetyDaysAgo = new Date(today.getTime() - (90 * 24 * 60 * 60 * 1000));\n\nconst items = $input.all();\nconst inactiveLeads = [];\n\nfor (const item of items) {\n const lastActivity = new Date(item.json.last_activity_date);\n if (lastActivity < ninetyDaysAgo) {\n const daysInactive = Math.floor((today - lastActivity) / (1000 * 60 * 60 * 24));\n inactiveLeads.push({\n json: {\n ...item.json,\n days_inactive: daysInactive\n }\n });\n }\n}\n\nreturn inactiveLeads;"
},
"typeVersion": 2
},
{
"id": "fc0dd085-12e6-4f31-882d-80212b9be73c",
"name": "Check funding events (Crunchbase)",
"type": "n8n-nodes-base.httpRequest",
"position": [
4000,
2112
],
"parameters": {
"url": "=https://api.crunchbase.com/api/v4/autocompletes?query={{ $json.company }}",
"options": {
"response": {
"response": {
"fullResponse": true
}
}
},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "X-cb-user-key",
"value": "={{ $credentials.crunchbaseApiKey }}"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "6a1a9462-aca6-4674-aefd-6cba41c3a07d",
"name": "Check company news (NewsAPI)",
"type": "n8n-nodes-base.httpRequest",
"position": [
4000,
2304
],
"parameters": {
"url": "=https://newsapi.org/v2/everything?q={{ encodeURIComponent($json.company) }}&sortBy=publishedAt&pageSize=5",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "apiKey",
"value": "={{ $credentials.newsApiKey }}"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "ca12ba47-cf8e-46a6-8521-ba119cb15057",
"name": "Check leadership changes (Hunter)",
"type": "n8n-nodes-base.httpRequest",
"position": [
4000,
2512
],
"parameters": {
"url": "=https://api.hunter.io/v2/domain-search?domain={{ $json.company.toLowerCase().replace(/[^a-z0-9]/g, '') }}.com",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "api_key",
"value": "={{ $credentials.hunterApiKey }}"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "8bddfdd8-3b30-4f5c-945f-a7b017510a17",
"name": "Analyze trigger events",
"type": "n8n-nodes-base.code",
"position": [
4224,
2304
],
"parameters": {
"jsCode": "// Combine and analyze trigger events from all sources\nconst leadData = $('Filter dormant leads (90+ days)').item.json;\nconst crunchbaseData = $('Check funding events (Crunchbase)').item.json || {};\nconst newsData = $('Check company news (NewsAPI)').item.json || {};\nconst hunterData = $('Check leadership changes (Hunter)').item.json || {};\n\nconst triggerEvents = [];\n\n// Check Crunchbase for funding events\nif (crunchbaseData.entities && crunchbaseData.entities.length > 0) {\n const entity = crunchbaseData.entities[0];\n if (entity.properties) {\n if (entity.properties.last_funding_type) {\n triggerEvents.push({\n type: 'Funding',\n source: 'Crunchbase',\n details: `Recent ${entity.properties.last_funding_type} funding round`,\n date: entity.properties.last_funding_at || 'Recent'\n });\n }\n }\n}\n\n// Check NewsAPI for recent news\nif (newsData.articles && newsData.articles.length > 0) {\n const recentArticle = newsData.articles[0];\n const articleDate = new Date(recentArticle.publishedAt);\n const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);\n \n if (articleDate > thirtyDaysAgo) {\n triggerEvents.push({\n type: 'News',\n source: 'NewsAPI',\n details: recentArticle.title,\n date: recentArticle.publishedAt,\n url: recentArticle.url\n });\n }\n}\n\n// Check Hunter for new executives\nif (hunterData.data && hunterData.data.emails) {\n const executives = hunterData.data.emails.filter(e => \n e.position && (\n e.position.toLowerCase().includes('vp') ||\n e.position.toLowerCase().includes('chief') ||\n e.position.toLowerCase().includes('director') ||\n e.position.toLowerCase().includes('head')\n )\n );\n \n if (executives.length > 0) {\n // Note: Hunter doesn't provide hire dates, so this is a presence check\n triggerEvents.push({\n type: 'Leadership',\n source: 'Hunter.io',\n details: `Found ${executives.length} executive contacts at company`,\n date: 'Current'\n });\n }\n}\n\n// Only proceed if we found trigger events\nif (triggerEvents.length === 0) {\n return []; // Skip this lead - no triggers found\n}\n\nreturn [{\n json: {\n ...leadData,\n trigger_events: triggerEvents,\n primary_trigger: triggerEvents[0]\n }\n}];"
},
"typeVersion": 2
},
{
"id": "d23cf94e-cb29-4210-821b-422eded211e7",
"name": "Generate re-engagement email",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
4432,
2304
],
"parameters": {
"text": "=Write a re-engagement email for the following lead:\n\nLEAD INFORMATION:\n- Name: {{ $json.contact_name }}\n- Title: {{ $json.title }}\n- Company: {{ $json.company }}\n- Industry: {{ $json.industry }}\n- Company Size: {{ $json.company_size }}\n\nHISTORY:\n- Previous Status: {{ $json.status }}\n- Days Since Last Contact: {{ $json.days_inactive }}\n- Original Loss Reason: {{ $json.loss_reason }}\n\nTRIGGER EVENT DETECTED:\n- Type: {{ $json.primary_trigger.type }}\n- Details: {{ $json.primary_trigger.details }}\n- Source: {{ $json.primary_trigger.source }}\n\nWrite the email now.",
"options": {
"systemMessage": "You are a professional B2B sales email writer specializing in re-engagement campaigns. Your expertise is crafting emails that reconnect with dormant leads by leveraging recent company events as conversation starters.\n\nYour writing style:\n- Professional and formal tone\n- Concise and respectful of the reader's time\n- Value-focused, not salesy or pushy\n- Personalized based on the recipient's role and industry\n\nEmail structure you follow:\n1. Open with acknowledgment or congratulations on their recent news/achievement\n2. Brief, subtle reference to your previous connection (without being presumptuous)\n3. Clear value proposition relevant to their current situation\n4. Soft call-to-action suggesting a brief reconnection call\n\nConstraints:\n- Keep emails under 150 words\n- Never include subject lines in the body\n- Always end with [Your Name] as a placeholder for the sales rep\n- Never use generic phrases like \"I hope this email finds you well\""
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "3612a7cf-6b8b-4088-8d96-92a3239c2e4c",
"name": "Claude Sonnet 4",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
4336,
2528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-5-20250929",
"cachedResultName": "Claude Sonnet 4.5"
},
"options": {
"temperature": 0.7,
"maxTokensToSample": 1024
}
},
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "39482e0b-d9a0-42b0-a81b-6ba5b913ffec",
"name": "Format notification for rep",
"type": "n8n-nodes-base.code",
"position": [
4736,
2304
],
"parameters": {
"jsCode": "// Format the final output for the rep notification email\nconst lead = $('Analyze trigger events').item.json;\nconst aiResponse = $('Generate re-engagement email').item.json;\n// Handle AI Agent output format\nconst emailDraft = aiResponse.output || aiResponse.text || aiResponse.message?.content || aiResponse.content || 'Error: Could not generate email';\n\nconst triggersFormatted = lead.trigger_events.map(t => \n `- ${t.type} (${t.source}): ${t.details}`\n).join('\\n');\n\nconst repEmailBody = `\n===========================================\nRE-ENGAGEMENT OPPORTUNITY DETECTED\n===========================================\n\nLEAD DETAILS\n------------\nCompany: ${lead.company}\nContact: ${lead.contact_name}, ${lead.title}\nEmail: ${lead.contact_email}\nIndustry: ${lead.industry}\nCompany Size: ${lead.company_size}\n\nHISTORY\n-------\nOriginal Status: ${lead.status}\nLast Activity: ${lead.last_activity_date} (${lead.days_inactive} days ago)\nOriginal Opportunity: $${lead.original_opportunity_value.toLocaleString()}\nLoss Reason: ${lead.loss_reason}\n\nTRIGGER EVENTS DETECTED\n-----------------------\n${triggersFormatted}\n\n===========================================\nSUGGESTED EMAIL DRAFT\n===========================================\n\nSubject: Congratulations on ${lead.primary_trigger.details}\n\n${emailDraft}\n\n===========================================\n\nTo send this email, reply to this notification or log into your CRM.\n\n--\nLead Re-engagement Agent\nAutomated Lead Re-engagement System\n`;\n\nreturn [{\n json: {\n to: lead.assigned_rep,\n subject: `Re-engagement Opportunity: ${lead.company} - ${lead.primary_trigger.type} Trigger`,\n body: repEmailBody,\n lead_id: lead.id,\n lead_email: lead.contact_email,\n draft_subject: `Congratulations on ${lead.primary_trigger.details}`,\n draft_body: emailDraft\n }\n}];"
},
"typeVersion": 2
},
{
"id": "8ad3c4f4-3e74-4438-90fe-5be15380b849",
"name": "Send notification (Gmail)",
"type": "n8n-nodes-base.gmail",
"position": [
4992,
2304
],
"parameters": {
"sendTo": "={{ $json.to }}",
"message": "={{ $json.body }}",
"options": {},
"subject": "={{ $json.subject }}"
},
"typeVersion": 2.1
},
{
"id": "6b6cc060-edc1-4cb4-ba4c-115e1938eaec",
"name": "Test workflow manually",
"type": "n8n-nodes-base.manualTrigger",
"position": [
3344,
2512
],
"parameters": {},
"typeVersion": 1
}
],
"active": false,
"settings": {
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "8a7b6503-ef8f-4645-97dd-1388ab1d44d3",
"connections": {
"Claude Sonnet 4": {
"ai_languageModel": [
[
{
"node": "Generate re-engagement email",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Analyze trigger events": {
"main": [
[
{
"node": "Generate re-engagement email",
"type": "main",
"index": 0
}
]
]
},
"Test workflow manually": {
"main": [
[
{
"node": "Load inactive leads (mock)",
"type": "main",
"index": 0
}
]
]
},
"Weekly schedule trigger": {
"main": [
[
{
"node": "Load inactive leads (mock)",
"type": "main",
"index": 0
}
]
]
},
"Load inactive leads (mock)": {
"main": [
[
{
"node": "Filter dormant leads (90+ days)",
"type": "main",
"index": 0
}
]
]
},
"Format notification for rep": {
"main": [
[
{
"node": "Send notification (Gmail)",
"type": "main",
"index": 0
}
]
]
},
"Check company news (NewsAPI)": {
"main": [
[
{
"node": "Analyze trigger events",
"type": "main",
"index": 0
}
]
]
},
"Generate re-engagement email": {
"main": [
[
{
"node": "Format notification for rep",
"type": "main",
"index": 0
}
]
]
},
"Filter dormant leads (90+ days)": {
"main": [
[
{
"node": "Check funding events (Crunchbase)",
"type": "main",
"index": 0
},
{
"node": "Check company news (NewsAPI)",
"type": "main",
"index": 0
},
{
"node": "Check leadership changes (Hunter)",
"type": "main",
"index": 0
}
]
]
},
"Check funding events (Crunchbase)": {
"main": [
[
{
"node": "Analyze trigger events",
"type": "main",
"index": 0
}
]
]
},
"Check leadership changes (Hunter)": {
"main": [
[
{
"node": "Analyze trigger events",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
anthropicApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Automatically re-engages dormant leads by detecting trigger events (funding rounds, company news, leadership changes) and generating personalized outreach emails. The workflow identifies leads inactive for 90+ days, checks multiple data sources for re-engagement opportunities,…
Source: https://n8n.io/workflows/12712/ — 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.
The Multi-Model Agency Content Engine is a high-performance editorial system designed for agencies. It solves the "blank page" problem by alternating between real-world social proof and strategic expe
If you teach on Udemy at any meaningful scale, you already know the problem: 80% of student messages are variations of the same handful of questions, but every one of them needs a thoughtful reply to
Aggregates communication data from Slack, Microsoft Teams, Gmail, GitHub, and Confluence into a single, unified AI-powered analysis workflow designed for quality review and automated documentation upd
This workflow automates tax compliance monitoring and revenue analysis for accounting teams and finance managers handling multi-source income data. It solves the critical problem of manually tracking
This workflow automates insurance premium adjustments by analyzing telematics data with AI-driven risk assessment and syncing changes across underwriting systems. Designed for carriers, actuaries, and