Analyse des prospects et génération automatisée d'e-mails personnalisés avec OpenAI

Avancé

Ceci est uncontenant 16 nœuds.Utilise principalement des nœuds comme If, Code, Gmail, JotFormTrigger, Agent. Automatisation de la qualification des prospects et du contact personnalisé avec Jotform, GPT et Gmail

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Clé API OpenAI

Catégorie

-
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "ymalyY9DUuChbG1t",
  "meta": {
    "instanceId": "277842713620d9f5554de3b1518b865a152c8c4db680008bd8aec536fc18b4a8",
    "templateCredsSetupCompleted": true
  },
  "name": "Lead Analysis & Personalized Email Generation with OpenAI",
  "tags": [
    {
      "id": "CWardZYJBmejoyC4",
      "name": "under review",
      "createdAt": "2025-10-09T18:43:37.031Z",
      "updatedAt": "2025-10-09T18:43:37.031Z"
    }
  ],
  "nodes": [
    {
      "id": "09a1ecea-b67c-4a79-a6e1-6d2adf1a4e87",
      "name": "Extraire le domaine",
      "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": "Marquer les adresses email personnelles",
      "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": "Email personnel ?",
      "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": "Agent commercial IA",
      "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": "Modèle de chat OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        336,
        624
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8IkhtT3EbXygnvcr",
          "name": "Klinsman OpenAI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1a825199-e929-4472-a0d6-a6e68c38ef46",
      "name": "Analyseur de sortie structurée",
      "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": "Résumer le site web",
      "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": {
          "id": "8IkhtT3EbXygnvcr",
          "name": "Klinsman OpenAI"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "c5ccdf39-e499-4dc1-8b3a-3d70e34ab623",
      "name": "Note adhésive 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        112
      ],
      "parameters": {
        "color": 4,
        "width": 624,
        "height": 656,
        "content": "## 🕷️ 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** 🌐 → **AI Summarization** 🤖\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 ✨"
      },
      "typeVersion": 1
    },
    {
      "id": "4ecbeb24-7237-4d17-a5bf-6c700a375dab",
      "name": "Déclencheur JotForm",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -1616,
        320
      ],
      "webhookId": "08ad777f-71ae-43a7-bae4-12b584899467",
      "parameters": {
        "form": "252815075257460"
      },
      "credentials": {
        "jotFormApi": {
          "id": "cOSh16Q5l4e0EB1A",
          "name": "Jotform jitesh@mediajade.com"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f62c4c09-6952-4090-8ea5-e0b13f31ed48",
      "name": "Extraire le site web",
      "type": "n8n-nodes-url-to-html.urlToHtml",
      "position": [
        -480,
        528
      ],
      "parameters": {
        "url": "={{ $json.websiteDomain }}"
      },
      "credentials": {
        "urlToHtmlApi": {
          "id": "0wD33X0UF8lvyVM8",
          "name": "URL to HTML account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eba67aae-a5a5-4335-9448-cb43792b2b31",
      "name": "Attendre l'approbation",
      "type": "n8n-nodes-base.gmail",
      "position": [
        752,
        368
      ],
      "webhookId": "7633d532-d9df-4788-95bf-6a612bda1956",
      "parameters": {
        "sendTo": "jitesh@mediajade.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": {
          "id": "PIMDNhXNj8Zyiz3G",
          "name": "Gmail account - Deepanshi"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "66388dba-ff63-46a1-af4c-0a6ef9960c9b",
      "name": "Note adhésive 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1664,
        -64
      ],
      "parameters": {
        "color": 5,
        "width": 832,
        "height": 688,
        "content": "## 📧 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** 🎯 → **Extract Domain** 🔗 → **Flag Personal Email** 🚩 → **Route Lead** ⚡\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 → Personal emails get regret message\n\n**Result:** Sales team only sees qualified B2B prospects ✅"
      },
      "typeVersion": 1
    },
    {
      "id": "04cc25db-45c5-49ec-adf3-c0818adc0fa3",
      "name": "Envoyer l'email de refus",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -464,
        -304
      ],
      "webhookId": "48608edc-7d54-47f6-94eb-9b92031eeb37",
      "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": {
          "id": "PIMDNhXNj8Zyiz3G",
          "name": "Gmail account - Deepanshi"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b0756128-2965-4339-94b0-46ed7edcacb6",
      "name": "Envoyer l'email de bienvenue",
      "type": "n8n-nodes-base.gmail",
      "position": [
        976,
        368
      ],
      "webhookId": "4b4f4878-4dee-47de-8306-146bd4224efc",
      "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": {
          "id": "PIMDNhXNj8Zyiz3G",
          "name": "Gmail account - Deepanshi"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7ed6820d-bf53-4983-9767-f7aac0b9af55",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -576
      ],
      "parameters": {
        "color": 3,
        "width": 544,
        "height": 480,
        "content": "## ❌ 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 🤝"
      },
      "typeVersion": 1
    },
    {
      "id": "545c8608-55c4-4127-a415-5613881e9a28",
      "name": "Note adhésive 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        -112
      ],
      "parameters": {
        "color": 6,
        "width": 960,
        "height": 912,
        "content": "## 🤖 Personalized Email\n\nAI agent analyzes qualified leads and drafts personalized outreach emails with human approval.\n\n### Flow\n\n**AI Sales Agent** 🧠 → **Wait for Approval** ⏸️ → **Send Welcome Email** 📧\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 🎯"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c48712f2-3289-4049-8c80-36a9715804f7",
  "connections": {
    "4c87424a-e345-4dd9-a208-4b860266385d": {
      "main": [
        [
          {
            "node": "eba67aae-a5a5-4335-9448-cb43792b2b31",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "09a1ecea-b67c-4a79-a6e1-6d2adf1a4e87": {
      "main": [
        [
          {
            "node": "a0748ec0-121e-4b8d-8a4b-1644fb70c6ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f62c4c09-6952-4090-8ea5-e0b13f31ed48": {
      "main": [
        [
          {
            "node": "c9f577dc-f5ca-416e-879b-83d55f5c58e7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4ecbeb24-7237-4d17-a5bf-6c700a375dab": {
      "main": [
        [
          {
            "node": "09a1ecea-b67c-4a79-a6e1-6d2adf1a4e87",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "382a768d-ff17-4994-9f7e-eda054e90f0a": {
      "ai_languageModel": [
        [
          {
            "node": "4c87424a-e345-4dd9-a208-4b860266385d",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "c9f577dc-f5ca-416e-879b-83d55f5c58e7": {
      "main": [
        [
          {
            "node": "4c87424a-e345-4dd9-a208-4b860266385d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eba67aae-a5a5-4335-9448-cb43792b2b31": {
      "main": [
        [
          {
            "node": "b0756128-2965-4339-94b0-46ed7edcacb6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "34e7976f-12d6-4aab-a706-6210e91c3f81": {
      "main": [
        [
          {
            "node": "04cc25db-45c5-49ec-adf3-c0818adc0fa3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "f62c4c09-6952-4090-8ea5-e0b13f31ed48",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1a825199-e929-4472-a0d6-a6e68c38ef46": {
      "ai_outputParser": [
        [
          {
            "node": "4c87424a-e345-4dd9-a208-4b860266385d",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "a0748ec0-121e-4b8d-8a4b-1644fb70c6ad": {
      "main": [
        [
          {
            "node": "34e7976f-12d6-4aab-a706-6210e91c3f81",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds16
Catégorie-
Types de nœuds10
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Jitesh Dugar

Jitesh Dugar

@jiteshdugar

AI Automation Specialist - OpenAI, CRM & Automation Expert with a solid understanding of various tools that include Zapier, Make, Zoho CRM, Hubspot, Google Sheets, Airtable, Pipedrive, Google Analytics, and more.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34