This workflow corresponds to n8n.io template #9431 — 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": "ymalyY9DUuChbG1t",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Lead Analysis & Personalized Email Generation with OpenAI",
"tags": [
{
"id": "TDW7E4RVCMchXf5b",
"name": "published",
"createdAt": "2025-10-13T01:18:01.305Z",
"updatedAt": "2025-10-13T01:18:01.305Z"
}
],
"nodes": [
{
"id": "09a1ecea-b67c-4a79-a6e1-6d2adf1a4e87",
"name": "Extract Domain",
"type": "n8n-nodes-base.code",
"position": [
-1392,
320
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.map(item => {\n const email = item.json['E-mail'];\n const domain = email ? email.split('@')[1] : null;\n \n return {\n json: {\n websiteDomain: domain ? 'https:' + '//' + domain : null // Break up the protocol\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "a0748ec0-121e-4b8d-8a4b-1644fb70c6ad",
"name": "Flag personal email addresses",
"type": "n8n-nodes-base.code",
"position": [
-1216,
320
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Flag items based on common email providers\nconst commonProviders = [\n 'gmail', 'yahoo', 'ymail', 'rocketmail',\n 'outlook', 'hotmail', 'live', 'msn',\n 'icloud', 'me', 'mac', 'aol',\n 'zoho', 'protonmail', 'mail', 'gmx'\n];\n\nconst websiteDomain = $input.item.json.websiteDomain;\nconst protocol = 'https:' + '//'; // Break up the protocol\nconst domain = websiteDomain ? websiteDomain.replace(protocol, '') : '';\nconst domainParts = domain.split('.');\nconst mainDomain = domainParts[0].toLowerCase();\nconst isCommonProvider = commonProviders.includes(mainDomain);\n\nreturn {\n json: {\n ...$input.item.json,\n isPersonalEmail: isCommonProvider\n }\n};"
},
"typeVersion": 2
},
{
"id": "34e7976f-12d6-4aab-a706-6210e91c3f81",
"name": "Is Personal Email?",
"type": "n8n-nodes-base.if",
"position": [
-1008,
320
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d7f56829-f0e9-4271-b981-0800d8faad1e",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.isPersonalEmail }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4c87424a-e345-4dd9-a208-4b860266385d",
"name": "AI Sales Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
400,
368
],
"parameters": {
"text": "=We have a new inbound lead as someone left their email address on our landing page. We already scraped their website, find it below, and I now need you to analyze this prospect and help me write an initial outreach email.\n\nUse Github-flavored-markdown for interest, ICP and personalization reasoning.\nThe email draft needs to be in html format though! should we well formatted,concise and have pointers instead of paragraphs.\n\nAlso fetch previous positive examples to use as a reference of what is a good analysis and email draft.\n\n<Lead Info>\nEmail: {{ $('Jotform Trigger').item.json['E-mail'] }}\nWebsite: {{ $('Extract Domain').item.json.websiteDomain }}\n</Lead Info>\n\n<Website Summary>\n{{ $json.message.content }}\n</Website Summary>\n\nToday is {{ $today }}.\n\n---\n\n## ABOUT OUR COMPANY & OFFERINGS\n\n**Company:** ClareVoice\n\n**What We Do:**\nClareVoice provides enterprise-grade Voice AI Agent solutions that automate phone conversations and customer interactions. Our AI agents handle inbound and outbound calls with human-like conversation quality, helping businesses scale their customer communications without scaling headcount.\n\n**Core Solutions:**\n\n1. **Inbound AI Agents**\n - 24/7 customer support and inquiry handling\n - Appointment scheduling and booking\n - Order status and tracking\n - Lead qualification and routing\n - FAQ handling and information delivery\n\n2. **Outbound AI Agents**\n - Lead follow-up and nurturing\n - Appointment confirmations and reminders\n - Customer satisfaction surveys\n - Payment reminders and collections\n - Re-engagement campaigns\n\n3. **Integration Capabilities**\n - Seamless CRM integration (Salesforce, HubSpot, etc.)\n - Calendar systems (Google Calendar, Outlook, etc.)\n - Ticketing systems (Zendesk, Freshdesk, etc.)\n - Custom API integrations\n - Real-time data synchronization\n\n**Key Benefits:**\n- Reduce response times from hours to seconds\n- Handle unlimited concurrent calls\n- Lower operational costs by 60-80%\n- Improve customer satisfaction with instant responses\n- Scale during peak periods without additional staffing\n- Capture every lead - no missed calls\n- Multilingual support capabilities\n- Detailed analytics and conversation insights\n\n**Ideal Customer Profile (ICP):**\n- **Industries:** Healthcare, Real Estate, Home Services, E-commerce, Financial Services, SaaS, Automotive, Legal Services\n- **Company Size:** 10-500 employees\n- **Pain Points:** High call volumes, missed calls, slow response times, expensive customer support teams, after-hours inquiries, lead follow-up delays\n- **Use Cases:** Businesses with repetitive phone tasks, appointment-based services, high inbound inquiry volume, or struggling with lead response times\n\n**Differentiators:**\n- Natural, conversational AI (not robotic)\n- Custom training on your business processes\n- White-glove onboarding and setup\n- Enterprise-level security and compliance\n- Real human escalation when needed\n- Continuous learning and improvement\n\n**Pricing Model:**\n- Flexible plans based on call volume and features\n- Custom enterprise solutions available\n- ROI typically achieved within 3 months\n\n---\n\n## YOUR TASK\n\n1. **Analyze the prospect** based on their website summary:\n - Industry and business model\n - Potential pain points that ClareVoice could solve\n - ICP fit score (High/Medium/Low) with reasoning\n - Specific use cases that would resonate\n\n2. **Identify personalization opportunities:**\n - Specific services they offer that could benefit from Voice AI\n - Business challenges visible on their website\n - Growth indicators or scaling signals\n - Recent changes or initiatives mentioned\n\n3. **Draft an outreach email:**\n - Subject line (compelling and personalized)\n - Email body (conversational, value-focused, not salesy)\n - Clear call-to-action\n - Keep it under 150 words\n - Reference something specific from their website\n - Focus on ONE specific use case that's most relevant to them",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "382a768d-ff17-4994-9f7e-eda054e90f0a",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
336,
624
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "1a825199-e929-4472-a0d6-a6e68c38ef46",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
624,
624
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n \"required\": [\n \"industry\",\n \"reasoningForInterestInOurProduct_markdown\",\n \"reasoningIfIdealCustomerProfile_markdown\",\n \"personalizationHook_markdown\",\n \"companyBudgetAssessment\",\n \"priorityRating\",\n \"emailDraftSubject\",\n \"emailDraftBodyHtml\"\n ],\n\t\"properties\": {\n \"industry\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"reasoningForInterestInOurProduct_markdown\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"reasoningIfIdealCustomerProfile_markdown\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"reasoningPersonalizationHook_markdown\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"companyBudgetAssessment\": {\n\t\t\t\"enum\": [\"high\", \"medium\", \"low\"]\n\t\t},\n\t\t\"priorityRating\": {\n\t\t\t\"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 10\n\t\t},\n\t\t\"emailDraftSubject\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"emailDraftBodyHtml\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
},
"typeVersion": 1.3
},
{
"id": "c9f577dc-f5ca-416e-879b-83d55f5c58e7",
"name": "Summarize website",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-256,
528
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=We scraped a website. Please summarize the content in markdown (gfm) in 2-3 paragraphs highlighting their industry, positioning, service or product offerings and any hints on recent activities and strategic moves.\n\n<ScrapingResult>\n{{ $json.html }}\n</ScrapingResult>"
}
]
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "c5ccdf39-e499-4dc1-8b3a-3d70e34ab623",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-544,
112
],
"parameters": {
"color": 4,
"width": 624,
"height": 656,
"content": "## \ud83d\udd77\ufe0f Scrape & Summarize Company Website\n\nAutomatically extracts and analyzes the prospect's website to understand their business.\n\n### Flow\n\n**URL to HTML** \ud83c\udf10 \u2192 **AI Summarization** \ud83e\udd16\n\n1. Fetches full website content from the extracted domain\n2. AI analyzes the HTML to extract key business info:\n - Industry & services offered\n - Pain points & use cases\n - Company size & signals\n - Personalization opportunities\n\n**Output:** Structured summary used for lead scoring and personalized outreach \u2728"
},
"typeVersion": 1
},
{
"id": "f62c4c09-6952-4090-8ea5-e0b13f31ed48",
"name": "Scrape Website",
"type": "n8n-nodes-url-to-html.urlToHtml",
"position": [
-480,
528
],
"parameters": {
"url": "={{ $json.websiteDomain }}"
},
"credentials": {
"urlToHtmlApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "eba67aae-a5a5-4335-9448-cb43792b2b31",
"name": "Wait for Approval",
"type": "n8n-nodes-base.gmail",
"position": [
752,
368
],
"parameters": {
"sendTo": "user@example.com",
"message": "=Hi there,\n\nAn email has been drafted for a new lead and is ready to be sent out. \n\nEmail Subject: {{ $json.output.emailDraftSubject }}\n\nEmail Body: {{ $json.output.emailDraftBodyHtml }}\n\nNeed your approval. ",
"options": {},
"subject": "=Email Ready for New Lead - {{ $('Jotform Trigger').item.json['E-mail'] }}",
"operation": "sendAndWait"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "66388dba-ff63-46a1-af4c-0a6ef9960c9b",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1664,
-64
],
"parameters": {
"color": 5,
"width": 832,
"height": 688,
"content": "## \ud83d\udce7 Lead Intake & Email Qualification\n\nCaptures demo requests and filters out personal emails to focus on qualified business leads.\n\n### Flow\n**Jotform Trigger** \ud83c\udfaf \u2192 **Extract Domain** \ud83d\udd17 \u2192 **Flag Personal Email** \ud83d\udea9 \u2192 **Route Lead** \u26a1\n\n1. Form submission captured via **Jotform** ([Sign up here](https://www.jotform.com/?partner=mediajade))\n2. Email domain extracted (`mediajade.com` + `https://mediajade.com`)\n3. Checked against personal providers (Gmail, Yahoo, Outlook, etc.)\n4. Business emails continue \u2192 Personal emails get regret message\n\n**Result:** Sales team only sees qualified B2B prospects \u2705"
},
"typeVersion": 1
},
{
"id": "04cc25db-45c5-49ec-adf3-c0818adc0fa3",
"name": "Send Regret Email",
"type": "n8n-nodes-base.gmail",
"position": [
-464,
-304
],
"parameters": {
"sendTo": "={{ $('Jotform Trigger').item.json['E-mail'] }}",
"message": "=Hi {{ $('Jotform Trigger').item.json['Full Name'].first }},\n\nThanks so much for your interest in ClareVoice and taking the time to fill out our demo request form.\n\nAfter reviewing your information, it looks like our Voice AI Agent solutions might not be the best fit for your current needs at this time. We typically work with businesses that handle high volumes of phone calls or have appointment-based services where automation can deliver significant ROI.\n\nThat said, if your communication needs change or your call volume increases in the future, we'd love to reconnect. Feel free to reach out anytime at [your email].\n\nI appreciate you considering ClareVoice, and I wish you all the best with [their company name]!\n\nBest,\nJitesh Dugar\nFounder - ClareVoice",
"options": {
"appendAttribution": false
},
"subject": "Re: Your ClareVoice Demo Request",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "b0756128-2965-4339-94b0-46ed7edcacb6",
"name": "Send Welcome Email",
"type": "n8n-nodes-base.gmail",
"position": [
976,
368
],
"parameters": {
"sendTo": "={{ $('Jotform Trigger').item.json['E-mail'] }}",
"message": "={{ $('AI Sales Agent').item.json.output.emailDraftBodyHtml }}",
"options": {
"appendAttribution": false
},
"subject": "={{ $('AI Sales Agent').item.json.output.emailDraftSubject }}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "7ed6820d-bf53-4983-9767-f7aac0b9af55",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
-576
],
"parameters": {
"color": 3,
"width": 544,
"height": 480,
"content": "## \u274c Send Regret Email\n\nPolitely declines unqualified leads (personal emails) while keeping the door open for future opportunities.\n\nSends a friendly rejection email explaining:\n- ClareVoice may not be the right fit at this time\n- Why they didn't qualify (personal email/small business)\n- Invitation to reconnect when they scale\n\n**Result:** Professional brand experience + potential future lead nurtured \ud83e\udd1d"
},
"typeVersion": 1
},
{
"id": "545c8608-55c4-4127-a415-5613881e9a28",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
256,
-112
],
"parameters": {
"color": 6,
"width": 960,
"height": 912,
"content": "## \ud83e\udd16 Personalized Email\n\nAI agent analyzes qualified leads and drafts personalized outreach emails with human approval.\n\n### Flow\n\n**AI Sales Agent** \ud83e\udde0 \u2192 **Wait for Approval** \u23f8\ufe0f \u2192 **Send Welcome Email** \ud83d\udce7\n\n1. **AI Agent** analyzes website summary using OpenAI\n - Scores ICP fit (High/Medium/Low)\n - Identifies pain points & use cases\n - Drafts personalized email referencing their business\n - Uses structured output parser for consistent formatting\n\n2. **Human Review** checks AI analysis and email draft before sending\n\n3. **Gmail** sends approved personalized welcome email\n\n**Result:** High-quality, researched outreach that resonates with each prospect \ud83c\udfaf"
},
"typeVersion": 1
},
{
"id": "4ecbeb24-7237-4d17-a5bf-6c700a375dab",
"name": "Jotform Trigger",
"type": "n8n-nodes-base.jotFormTrigger",
"position": [
-1616,
320
],
"parameters": {
"form": "252815075257460"
},
"credentials": {
"jotFormApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "f0b4bf08-4865-41ea-bd3a-4990326eb5d7",
"connections": {
"AI Sales Agent": {
"main": [
[
{
"node": "Wait for Approval",
"type": "main",
"index": 0
}
]
]
},
"Extract Domain": {
"main": [
[
{
"node": "Flag personal email addresses",
"type": "main",
"index": 0
}
]
]
},
"Scrape Website": {
"main": [
[
{
"node": "Summarize website",
"type": "main",
"index": 0
}
]
]
},
"Jotform Trigger": {
"main": [
[
{
"node": "Extract Domain",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Sales Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Summarize website": {
"main": [
[
{
"node": "AI Sales Agent",
"type": "main",
"index": 0
}
]
]
},
"Wait for Approval": {
"main": [
[
{
"node": "Send Welcome Email",
"type": "main",
"index": 0
}
]
]
},
"Is Personal Email?": {
"main": [
[
{
"node": "Send Regret Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Scrape Website",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Sales Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Flag personal email addresses": {
"main": [
[
{
"node": "Is Personal Email?",
"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.
gmailOAuth2jotFormApiopenAiApiurlToHtmlApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Automatically qualify inbound demo requests, scrape prospect websites, and send AI-personalized outreach emails—all on autopilot.
Source: https://n8n.io/workflows/9431/ — 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.
Transform accounts payable from a manual bottleneck into an intelligent, automated system that reads invoices, detects fraud, and processes payments automatically—saving 20+ hours per week while preve
Transform college admissions from an overwhelming manual process into an intelligent, efficient, and equitable system that analyzes essays, scores applicants holistically, and identifies top candidate
Revolutionize your recruitment process with intelligent AI-driven candidate screening that evaluates resumes, scores applicants, and automatically routes them based on fit - saving 10-15 hours per wee
This workflow automates the process of competitor creative analysis for Facebook Pages. When a user submits their email and a target Facebook Page URL via a web form, the workflow: Scrapes the latest
This n8n workflow is designed for e-commerce businesses, digital marketers, and content creators who want to automatically generate professional 3D product videos from product images. It's perfect for