This workflow corresponds to n8n.io template #9474 — 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "b5a08019-8bf0-4413-b25f-e731aa71b627",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
976,
224
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "af8f0e58-297f-482e-ac9b-32dc2ff19eff",
"name": "Send Welcome Email",
"type": "n8n-nodes-base.gmail",
"position": [
1472,
304
],
"parameters": {
"sendTo": "={{ $('On New JotForm Submission').item.json.email }}",
"message": "={{ $json.output }}",
"options": {
"appendAttribution": false
},
"subject": "=Welcome to Our Platform, {{ $('On New JotForm Submission').item.json.name.split(' ')[0] }}!"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "dced7d8d-7511-48a9-9739-3591ed4ccbc6",
"name": "On New JotForm Submission",
"type": "n8n-nodes-base.jotFormTrigger",
"position": [
0,
304
],
"parameters": {
"form": "="
},
"credentials": {
"jotFormApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "685bbdaa-c187-4a92-b2b9-4319352b1043",
"name": "Research Company via Perplexity AI",
"type": "n8n-nodes-base.perplexity",
"position": [
672,
112
],
"parameters": {
"model": "sonar-pro",
"options": {},
"messages": {
"message": [
{
"content": "=Research the company with domain {{ $json.domain_name }}. Provide a comprehensive overview including:\n\n1. Company name and overview\n2. Industry and market position\n3. Key products or services\n4. Recent news or developments\n5. Company culture and values\n6. Any notable achievements or recognition\n\nProvide detailed, accurate information that would help personalize a welcome email."
}
]
},
"requestOptions": {}
},
"credentials": {
"perplexityApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "fd7d1e5f-8a21-42f4-84d8-7aba61854782",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1184,
-880
],
"parameters": {
"width": 1024,
"height": 1040,
"content": "## Send smart, personalized welcome emails to any JotForm lead\n\nThis workflow intelligently qualifies new JotForm leads and sends the perfect welcome email every time. It detects whether a lead is using a business or personal email address and tailors the outreach accordingly\u2014either with deep company research for B2B leads or a warm, direct welcome for B2C leads.\n\n## Who's it for?\n- **Businesses with mixed audiences:** Companies that serve both business clients and individual users.\n- **Sales & Marketing Teams:** To automate lead qualification and send context-aware first-touch emails.\n- **Founders & Solopreneurs:** To ensure every new lead gets a relevant, personalized welcome without manual effort.\n\n## How it works\n1. **Trigger:** The workflow starts on a new JotForm submission.\n2. **Filter:** It checks if the lead's email is a work email (e.g., `jane@mycompany.com`) or a personal one (e.g., `john@gmail.com`).\n3. **Path A (Work Email):** The workflow researches the company using Perplexity AI and then uses OpenAI to draft a deeply personalized email referencing company-specific details.\n4. **Path B (Personal Email):** The workflow skips the research and uses OpenAI to draft a warm, friendly, but more general welcome email.\n5. **Send:** The appropriate, context-aware email is sent to the new lead via Gmail.\n\n## How to set up\n1. **JotForm:** Connect your JotForm credentials and choose your lead capture form. **Important:** Your form must contain fields with the exact names `name` and `email`. You can add other fields for more context (e.g., `company_size`).\n2. **Credentials:** Connect your Perplexity AI, OpenAI, and Gmail accounts.\n3. **Activate Workflow:** Turn the workflow on.\n\n## Requirements\n- An [n8n account](https://n8n.partnerlinks.io/hsfk0lhyvur4).\n- A [JotForm account](https://www.jotform.com/?partner=fahmifahreza).\n- A Perplexity AI account with API access.\n- An OpenAI account with API access.\n- A Gmail account.\n\n## How to customize the workflow\n- **Filter Logic:** Add more personal email domains (e.g., `icloud.com`) to the list in the `Check if Email is Work or Personal` node to improve filtering.\n- **Prompts:** Customize the prompts in both the AI Agent nodes to match your brand's voice and tone."
},
"typeVersion": 1
},
{
"id": "ab0b495c-e41c-4cc8-8ee7-0f8b796d83a6",
"name": "Extract Domain from Email",
"type": "n8n-nodes-base.set",
"position": [
224,
304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "domain-extract-field",
"name": "domain_name",
"type": "string",
"value": "={{ $json.email.split('@')[1] }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "62e2921d-1a46-40e6-be0e-e553af3fbd95",
"name": "If Work Email",
"type": "n8n-nodes-base.if",
"position": [
448,
304
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e3e98824-2a5a-4517-8f5b-5250e84c2839",
"operator": {
"type": "array",
"operation": "notContains",
"rightType": "any"
},
"leftValue": "={{ [\"gmail.com\",\"yahoo.com\", \"outlook.com\", \"yopmail.com\"] }}",
"rightValue": "={{$json.domain_name}}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ab0b4fc3-a515-4d0f-abe3-cabd7bf50840",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
1248,
304
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "8286a881-99c6-42a2-9765-b40dfd9a7d6a",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
976,
736
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "da8c05f2-dece-4320-821c-d486a19b39d8",
"name": "AI Company Email Writer",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
896,
0
],
"parameters": {
"text": "=Create a highly personalized welcome onboarding email for:\n\n**Lead Information:**\n- Name: {{ $('On New JotForm Submission').item.json.name }}\n- Email: {{ $('On New JotForm Submission').item.json.email }}\n- Company Domain: {{ $('Extract Domain from Email').item.json.domain_name }}\n\n**Company Research:**\n{{ $('Research Company via Perplexity AI').item.json.message.content }}\n\n**Additional Form Data:**\n{{ JSON.stringify($('On New JotForm Submission').item.json, null, 2) }}\n\n---\n\nCreate a warm, professional welcome email that:\n1. Addresses them by name\n2. Shows we've researched their company\n3. Demonstrates understanding of their industry/challenges\n4. Provides clear next steps\n5. Makes them excited to get started\n6. Includes a compelling subject line\n\nFormat the output as HTML email content with a subject line at the top.",
"options": {
"systemMessage": "=You are an expert email copywriter specializing in personalized B2B onboarding communications. Your emails are:\n\n- Warm yet professional\n- Highly personalized based on company research\n- Engaging and conversational\n- Clear about next steps\n- Focused on value and relevance to their business\n\nCreate emails that make recipients feel valued and understood. Use the company research to demonstrate genuine interest in their business. Keep the tone friendly but professional, and always include actionable next steps.\n\nOnly output the response in HTML and nothing else."
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "5cf08a12-c83f-43f9-858a-2e830eabf11d",
"name": "AI Personal Email Writer",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
896,
512
],
"parameters": {
"text": "=Create a highly personalized welcome onboarding email for:\n\n**Lead Information:**\n- Name: {{ $('On New JotForm Submission').item.json.name }}\n- Email: {{ $('On New JotForm Submission').item.json.email }}\n\n**Additional Form Data:**\n{{ JSON.stringify($('On New JotForm Submission').item.json, null, 2) }}\n\n---\n\nCreate a warm, professional personal welcome email that:\n1. Addresses them by name\n2. Demonstrates understanding of their challenges\n3. Provides clear next steps\n4. Makes them excited to get started\n5. Includes a compelling subject line\n\nFormat the output as HTML email content with a subject line at the top.",
"options": {
"systemMessage": "=You are an expert email copywriter specializing in personalized B2B onboarding communications. Your emails are:\n\n- Warm yet professional\n- Highly personalized based on company research\n- Engaging and conversational\n- Clear about next steps\n- Focused on value and relevance to their business\n\nCreate emails that make recipients feel valued and understood. Use the company research to demonstrate genuine interest in their business. Keep the tone friendly but professional, and always include actionable next steps.\n\nOnly output the response in HTML and nothing else."
},
"promptType": "define"
},
"typeVersion": 2.2
}
],
"connections": {
"Merge": {
"main": [
[
{
"node": "Send Welcome Email",
"type": "main",
"index": 0
}
]
]
},
"If Work Email": {
"main": [
[
{
"node": "Research Company via Perplexity AI",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Personal Email Writer",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Company Email Writer",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Personal Email Writer",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Company Email Writer": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"AI Personal Email Writer": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Extract Domain from Email": {
"main": [
[
{
"node": "If Work Email",
"type": "main",
"index": 0
}
]
]
},
"On New JotForm Submission": {
"main": [
[
{
"node": "Extract Domain from Email",
"type": "main",
"index": 0
}
]
]
},
"Research Company via Perplexity AI": {
"main": [
[
{
"node": "AI Company Email Writer",
"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.
gmailOAuth2jotFormApiopenAiApiperplexityApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow intelligently qualifies new Jotform leads and sends the perfect welcome email every time. It detects whether a lead is using a business or personal email address and tailors the outreach accordingly—either with deep company research for B2B leads or a warm, direct…
Source: https://n8n.io/workflows/9474/ — 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 guest complaints into loyalty opportunities - achieving 60% reduction in negative reviews, 85% faster service recovery, and turning dissatisfied guests into brand advocates through AI-powere
HR professionals and recruitment teams handling high application volumes Startup founders and hiring managers seeking to scale hiring efficiently Companies wanting consistent, objective candidate eval
Transform patient intake from paperwork chaos into intelligent, automated triage that detects emergencies, prepares providers with comprehensive briefs, and streamlines scheduling—improving patient sa
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