AutomationFlowsAI & RAG › Generate Personalized Cold Emails with Anthropic, Gpt-4 & Google Sheets

Generate Personalized Cold Emails with Anthropic, Gpt-4 & Google Sheets

ByBhuvanesh R @bhuvanesh on n8n.io

Your Cold Email is Now Researched. This pipeline finds specific bottlenecks on prospect websites and instantly crafts an irresistible pitch

Event trigger★★★★☆ complexityAI-powered24 nodesGmailGoogle SheetsHTTP RequestOpenAIAnthropic
AI & RAG Trigger: Event Nodes: 24 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #10266 — we link there as the canonical source.

This workflow follows the Gmail → 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 →

Download .json
{
  "id": "ISQl1ZnXPDDlWSuN",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "My Cold Email Generator",
  "tags": [],
  "nodes": [
    {
      "id": "0eac1a6b-0b4d-47d8-a80a-e9943dd8b1a1",
      "name": "Create a draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5456,
        -288
      ],
      "parameters": {
        "message": "=Hello {{ $json.first_name }},\n{{ $json.Icebreaker_body }}\n\nRegards,\nBhuvanesh",
        "options": {
          "sendTo": "={{ $json.email }}"
        },
        "subject": "={{ $json.Icebreaker_subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e9e12661-7809-4b13-ac5a-cfa01e1fef87",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        3440,
        -304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c8e42edd-c653-406b-a817-12e19234ebb1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "Success"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fdb78e15-cb51-486e-a113-01b6b6abd09f",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        2352,
        -1456
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "882fb7a2-7ba4-48f9-8b4c-499814a56dd3",
      "name": "Get All Leads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2576,
        -1456
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rUf_ReJMP1sQGUVj7Zfj4SYnmmM06_ZIOP1quabD6hI/edit#gid=0",
          "cachedResultName": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rUf_ReJMP1sQGUVj7Zfj4SYnmmM06_ZIOP1quabD6hI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rUf_ReJMP1sQGUVj7Zfj4SYnmmM06_ZIOP1quabD6hI/edit?usp=drivesdk",
          "cachedResultName": "Cold Email Icebreaker"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "dac7abb5-e34c-4cd9-b794-22d1130dc136",
      "name": "Filter (Qualified Leads)",
      "type": "n8n-nodes-base.filter",
      "position": [
        2800,
        -1456
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "10b40a26-d529-4aeb-9b5a-4007d9b516dc",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.icebreaker_subject }}",
              "rightValue": ""
            },
            {
              "id": "f4b49606-ad14-418b-9983-3f5e7a4a0e31",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.icebreaker_body }}",
              "rightValue": ""
            },
            {
              "id": "884bfab2-74ff-4888-bbc3-bd745be7e5a9",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": ""
            },
            {
              "id": "8a333ae0-717a-4aad-ab07-9bb3b6fc985a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.website_url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5bc390bb-567c-44ad-a2e3-ed0cb585ef9d",
      "name": "Loop Over Leads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1872,
        -1104
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "9982c117-d123-4568-952a-4d35cc3de958",
      "name": "Extract Text & Links",
      "type": "n8n-nodes-base.html",
      "position": [
        2720,
        -544
      ],
      "parameters": {
        "options": {
          "trimValues": true,
          "cleanUpText": true
        },
        "operation": "extractHtmlContent",
        "sourceData": "binary",
        "dataPropertyName": "binary",
        "extractionValues": {
          "values": [
            {
              "key": "links",
              "attribute": "href",
              "cssSelector": "a",
              "returnArray": true,
              "returnValue": "attribute"
            },
            {
              "key": "website_text",
              "cssSelector": "body",
              "returnArray": true
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5e749a6e-921b-426f-8991-d1b4d3f5c00c",
      "name": "Scrape Site",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2496,
        -544
      ],
      "parameters": {
        "url": "={{ $json.website_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "binary"
            }
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "34a3caf7-d823-46c7-8588-87d5a83e78ff",
      "name": "Capture Lead Data",
      "type": "n8n-nodes-base.set",
      "position": [
        2272,
        -544
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "da0dcf67-9cc1-482c-b66d-170258c2ea4d",
              "name": "row_number",
              "type": "number",
              "value": "={{ $json.row_number }}"
            },
            {
              "id": "42352b60-fecb-4ced-a603-376596409526",
              "name": "id",
              "type": "number",
              "value": "={{ $json.id }}"
            },
            {
              "id": "9a37c363-fbe2-40f7-93b3-d3a9e0aed3ff",
              "name": "first_name",
              "type": "string",
              "value": "={{ $json.first_name }}"
            },
            {
              "id": "e5650386-c9b6-4e9c-8991-10f880deab96",
              "name": "last_name",
              "type": "string",
              "value": "={{ $json.last_name }}"
            },
            {
              "id": "697008fe-4d34-416a-94c6-6497392a8255",
              "name": "email",
              "type": "string",
              "value": "={{ $json.email }}"
            },
            {
              "id": "27261a84-4425-42a0-9967-2136828bccd3",
              "name": "website_url",
              "type": "string",
              "value": "={{ $json.website_url }}"
            },
            {
              "id": "167a3409-718f-454d-97bf-76361b08b75a",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "0f4d452e-448d-441c-b6df-1dd15bb7fec7",
              "name": "company",
              "type": "string",
              "value": "={{ $json.company }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "974fcfea-1921-45a4-99d4-761b2d43e608",
      "name": "Filter Social & Status",
      "type": "n8n-nodes-base.code",
      "position": [
        2944,
        -544
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst outputItems = [];\n\nconst socialPatterns = ['linkedin.com', 'twitter.com', 'instagram.com'];\n\nfor (const item of items) {\n    const websiteText = item.json.website_text?.[0] || '';\n    const allExternalLinks = item.json.links || [];\n    \n    const socialLinks = allExternalLinks.filter(link => {\n        if (!link) return false; \n        return socialPatterns.some(pattern => link.toLowerCase().includes(pattern));\n    });\n\n    const socialLinksString = socialLinks.join('\\n');\n\n   \n    const originalLeadData = {\n        first_name: $('Capture Lead Data').first().json.first_name,\n        last_name: $('Loop Over Leads').first().json.last_name,\n        email: $('Loop Over Leads').first().json.email,\n        website_url: $('Loop Over Leads').first().json.website_url,\n        title: $('Loop Over Leads').first().json.title,\n        company: $('Loop Over Leads').first().json.company,\n        row_number: $('Loop Over Leads').first().json.row_number\n    };\n    \n    const processingStatus = (websiteText && websiteText.length > 50) ? 'Success' : 'Scrape Fail';\n\n    const newItem = {\n        website_text: websiteText, \n        social_links_string: socialLinksString,\n        all_lead_data: originalLeadData, \n        status: processingStatus\n    };\n\n    outputItems.push({ json: newItem });\n}\n\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "97a1c64c-e02e-42c7-82c4-50ba4d6df06f",
      "name": "Summarize Website",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        3920,
        -544
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "options": {
          "temperature": 0.1
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a rigorous, specialized business analyst focused on finding bottlenecks in customer operations. Your task is to provide a concise two-paragraph abstract of the company's profile.\n\nParagraph 1: Core Value Proposition. Summarize the company's main offering and target audience. Utilize [website_text].\n\nParagraph 2: Unique Hook & Operational Insight. Identify one single, non-obvious, specific detail that implies high operational overhead related to customer interaction (e.g., mention of manual booking/scheduling, high customer support call volume, specific lead intake forms, or customer service staffing/hiring challenges). Critically, the insight must relate to the administrative tasks that an AI Receptionist could automate: scheduling, qualification, or call handling. Utilize [website_text] and [social_links]."
            },
            {
              "content": "={{ $json.all_lead_data.company }}'s company data:\n1) [website_text]: {{ $json.website_text }}\n2) [social_links]: {{ $json.social_links_string }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "bf426de8-d6e3-4474-8f5e-0541277f1f56",
      "name": "Merge Summary",
      "type": "n8n-nodes-base.set",
      "position": [
        4272,
        -544
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5c1d4e92-e6a8-465e-aa12-752a8e582f2a",
              "name": "website_summary",
              "type": "string",
              "value": "={{ $json.message.content }}"
            },
            {
              "id": "225c3c64-5c62-44ee-922a-0a912825e5c6",
              "name": "all_lead_data",
              "type": "object",
              "value": "={{ $('Filter Social & Status').item.json.all_lead_data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ac63c0ff-87a5-41f1-82e3-b22498bfecf8",
      "name": "Generate Subject & Body",
      "type": "@n8n/n8n-nodes-langchain.anthropic",
      "position": [
        4496,
        -544
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "claude-haiku-4-5-20251001",
          "cachedResultName": "claude-haiku-4-5-20251001"
        },
        "options": {
          "system": "Persona:\nYou are a single, highly effective, spartan cold email copywriter. \n\nGoal:\nTo generate both a cohesive subject line and the multi-line body icebreaker copy in a single output. \n\nRules: \n1. Tone: Spartan, casual, and direct (like a bar conversation). \n2. Insight-Driven: Both subject and body must use the Company Summary's unique hook. \n3. Body: Must be 3-4 concise sentences long. Do not include a greeting (e.g., \"Hey [Name]\"). \n4. Output Format: You MUST output the JSON in the exact nested format provided below.",
          "maxTokens": 350,
          "temperature": 0
        },
        "messages": {
          "values": [
            {
              "content": "=Product Context: \nWe sell AI Voice Agents (AI Receptionists) that book, reschedule appointments, and handle lead qualification 24/7.\n\nIrresistible Sales Offer (Integrate This): \nWe run a Free 48-Hour Pilot where we deploy a human-like AI Receptionist to answer all your missed calls. The agent handles FAQs and books new appointments directly into your calendar, 24/7. In the end, you get a report showing exactly how many patient bookings the AI secured while your office was closed. No cost, zero risk. Would you be interested?\n\n\nThis is the company we are trying to sell our service to: {{ $json.all_lead_data.company }}\nThis the company's summary (Unique Hook Context (The Personalization Insight)): {{ $json.website_summary }}\nThe name of the person from the company we are going to email (Recipient): {{ $json.all_lead_data.first_name }}\n\n\nJSON Format ONLY:\n{\n\"message\": {\n\"subject\": \"[Short, Curious Subject based on unique hook]\",\n\"body\": \"[Body that uses the unique hook to transition immediately to the Free 48-Hour Pilot sales offer, ending with the specific CTA and guarantee. Use actual newline characters (\\n) for formatting.]\"\n}\n}"
            }
          ]
        }
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "444404fd-8635-4485-943a-f78df5b66e07",
      "name": "Parse AI Output",
      "type": "n8n-nodes-base.code",
      "position": [
        4848,
        -544
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst outputItems = [];\n\nfor (const item of items) {\n    const rawText = item.json.content[0].text;\n    \n    const cleanText = rawText.replace(/```json|```/g, '').trim();\n\n    let subject = 'AI_ERROR';\n    let body = 'Parsing Failed - Check Anthropic Output.';\n\n    try {\n      const parsed = JSON.parse(cleanText);\n\n      subject = parsed?.message?.subject || subject;\n      body = parsed?.message?.body || body;\n    } catch (error) {\n      console.error(\"JSON parse error:\", error);\n    }\n\n    outputItems.push({\n      json: {\n        subject: subject,\n        body: body,\n        all_lead_data: $('Merge Summary').first().json.all_lead_data, \n        website_summary: $('Merge Summary').first().json.website_summary\n      }\n    });\n}\n\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "23fbfc16-e835-437c-8cb0-a3ad0ee2e758",
      "name": "Log Final Result",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5232,
        -288
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $('Capture Lead Data').item.json.id }}",
            "email": "={{ $('Capture Lead Data').item.json.email }}",
            "status": "={{ $('Filter Social & Status').item.json.status }}",
            "last_name": "={{ $('Capture Lead Data').item.json.last_name }}",
            "first_name": "={{ $('Merge Summary').item.json.all_lead_data.first_name }}",
            "row_number": 0,
            "icebreaker_body": "={{ $json.body }}",
            "Icebreaker_subject": "={{ $json.subject }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "first_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "first_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "last_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "website_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "website_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Icebreaker_subject",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Icebreaker_subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "icebreaker_body",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "icebreaker_body",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rUf_ReJMP1sQGUVj7Zfj4SYnmmM06_ZIOP1quabD6hI/edit#gid=0",
          "cachedResultName": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rUf_ReJMP1sQGUVj7Zfj4SYnmmM06_ZIOP1quabD6hI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rUf_ReJMP1sQGUVj7Zfj4SYnmmM06_ZIOP1quabD6hI/edit?usp=drivesdk",
          "cachedResultName": "Cold Email Icebreaker"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ab1d0b36-d848-461a-9252-2628590feccc",
      "name": "Send Team Completion Alert",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5344,
        -1120
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "Dear team,\n\nYou can find the personalized cold email in the draft section!\n\n\n\nRegards,\nBhuvanesh\n",
        "options": {
          "appendAttribution": false
        },
        "subject": "re: Cold Emails are ready to be sent!",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a4d963e7-ebea-4a65-bca2-c7ce38c16161",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3888,
        -944
      ],
      "parameters": {
        "color": 2,
        "width": 1088,
        "height": 592,
        "content": "## **4. AI Personalization Engine**\n\n### 1.  **OpenAI (Summarize Website Hook):** \nUses **GPT-4** (or gpt-4o) with a low **Temperature (0.1)** to analytically extract the **Unique Operational Insight** (e.g., _manual scheduling dependency_ or _high inbound call volume_) and the core Value Prop.\n    \n### 2.  **Set (Merge Summary):** \nPackages the summary (website\\_summary) and the guaranteed all\\_lead\\_data for the final Anthropic prompt.\n    \n### 3.  **Anthropic (Generate Subject & Body):** \n**The Coherence Engine.** Uses **Claude Sonnet** with a strict prompt and **JSON Object** response to generate a **cohesive subject line and body**, ensuring the body incorporates the **Free 48-Hour Pilot** offer and uses the Unique Hook.\n    \n### 4.  **Code (Parse AI Output):** \n**Final Parser.** This node strips markdown wrappers (\\`\\`\\`json), handles character escaping, and reliably pulls the clean **subject** and **body** strings from the nested Anthropic output"
      },
      "typeVersion": 1
    },
    {
      "id": "3ca20d99-a682-41bb-be20-d0256b665f69",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3232,
        -944
      ],
      "parameters": {
        "color": 2,
        "width": 544,
        "height": 896,
        "content": "## **3. IF (Filtering)** \n\n**Goal:** Control execution flow and maximize **LLM token cost efficiency** by diverting bad leads.\n\nThis node is a critical architectural decision point that acts as a **Quality Gate** before the most expensive steps of the workflow.\n\n\n*   \u2705 **TRUE Branch (Status = 'Success'):** The lead has a good website, and the scrape was successful. It proceeds to **OpenAI (Node 9)**, where we budget for token usage.\n    \n*   \u274c **FALSE Branch (Status = 'Scrape Fail'):** The website failed to load or returned minimal text (less than 50 characters). It **bypasses all AI nodes** (OpenAI, Anthropic, Parsing) and jumps directly to **Google Sheets (Log Final Result)**.\n    \n\n**Cost Benefit:** By filtering here, the workflow **saves 100% of the token cost** and execution time for every prospect with a poor website, ensuring you only pay for high-quality, actionable personalization."
      },
      "typeVersion": 1
    },
    {
      "id": "bbdae9ce-cfef-4349-9b53-4f2454f9d005",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2176,
        -1696
      ],
      "parameters": {
        "width": 928,
        "height": 496,
        "content": "## **1. Data Ingestion & Filtering**\n\n### 1.  **Get All Leads:** \nReplace the placeholder **Spreadsheet ID** and **Sheet Name** with your master lead sheet details.\n    \n### 2.  **Filter:** \nThis node uses a powerful set of conditions (AND combinator) to ensure prospects proceed _only if_ they have a valid **email**, a **website\\_url**, and the Icebreaker field is currently **empty**."
      },
      "typeVersion": 1
    },
    {
      "id": "2d3bdc9c-d0be-486c-980e-1095de1d2952",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2176,
        -944
      ],
      "parameters": {
        "color": 2,
        "width": 928,
        "height": 608,
        "content": "## **2. Scraping & Data Shaping**\n\n### 1.  **HTTP Request (Scrape Site):** \nEnsure the URL uses the stable expression ={{ $json.website\\_url }}. **Response Format** is set to **File** to correctly deliver binary data to the next node.\n    \n### 2.  **HTML (Extract Text & Links):** \nThis node performs **simultaneous extraction**: it pulls the full website\\_text and an array of all links (including external social links).\n    \n### 3.  **Code (Filter Social & Status):**    \n*   **Filters** the links to isolate high-value platforms (LinkedIn, YouTube, etc.) into social\\_links\\_string.\n*   **Status Check:** Assigns the status property ('Success' or 'Scrape Fail') based on the presence and length of the scraped website text."
      },
      "typeVersion": 1
    },
    {
      "id": "e0c20f03-b200-42ee-bf9e-a8fed167aab4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5072,
        -1216
      ],
      "parameters": {
        "width": 640,
        "height": 1168,
        "content": "## **5. Logging, Draft and Alert**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### 1.  **Google Sheets (Log Final Result):** \nThis node uses the id for matching and writes the final data. It handles both **Success Path** (writing AI-generated subject/body and status: 'Success') and **Scrape Fail Path** (writing the 'Scrape Fail' status).\n    \n### 2.  **Gmail (Create a Draft):** \n**Quality Control.** Sends the fully assembled email draft to the workflow creator for a manual sanity check. This is your final defense against any AI \"hallucinations\" or formatting errors.\n    \n### 3.  **Loop Over Leads (Loop-Back):** \nThe output from **Gmail (Create a Draft)** loops back to the start of the **Loop Over Leads** node to process the next prospect.\n    \n### 4.  **Gmail (Send Team Completion Alert):** \nThis node is connected to the **After Last Batch** output of the main loop and runs only once the _entire batch_ is finished, notifying the sales team that a new list of highly personalized leads is ready."
      },
      "typeVersion": 1
    },
    {
      "id": "94a21ec9-b05b-4737-8a06-52d6a4292f98",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        -1840
      ],
      "parameters": {
        "color": 5,
        "width": 544,
        "height": 336,
        "content": "# Hello there!\n\n\n\n# Need support or have a workflow question?  \n\n## \ud83d\udd17 [Connect on LinkedIn](https://www.linkedin.com/in/bhuvaneshhhh/)"
      },
      "typeVersion": 1
    },
    {
      "id": "a466d18b-11a8-4ef0-98e5-0c999a32aee4",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        -1840
      ],
      "parameters": {
        "color": 7,
        "width": 4224,
        "height": 2016,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "772a5fab-5af7-48ce-9d7c-76051e02535e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        -1456
      ],
      "parameters": {
        "width": 544,
        "height": 944,
        "content": "# Personalized Cold Email Generator\n\n\n### Stage 1: Data Acquisition and Resilience\n\nThe process begins by reading qualified leads from **Google Sheets** and initiating a **Loop Over Leads** to process one prospect at a time. This loop is essential for **error isolation**. Inside the loop, the **HTTP Request** node scrapes the target website, and the **HTML** node performs **simultaneous extraction** of both the **website text** (core business info) and **external social links** (current culture/activity).\n\nThe **Code node (Filter Social & Status)** then acts as a **Quality Gate**: it filters non-relevant links, assigns a status (Success or Scrape Fail), and the subsequent **IF node** diverts bad leads directly to the final sheet update. This **saves 100% of AI token costs** on unusable prospects.\n\n### Stage 2: Dual-AI Synthesis and Coherence\n\nOnly successful leads proceed to the AI core:\n\n1.  **GPT-4 (Summarize Website Hook):** This node uses **GPT-4** with a low temperature to analytically synthesize the website text and social links, extracting the **Unique Operational Insight** (e.g., manual scheduling dependency).\n    \n2.  **Anthropic (Generate Subject & Body):** The most critical step. This single **Claude Sonnet** node uses the unique insight, your Irresistible Sales Offer (Free 48-Hour Pilot), and a strict prompt to generate a **coherent subject line and multi-line body** in a specific JSON format.\n    \n3.  **Code (Parse AI Output):** This final **Code node** reliably strips formatting quirks from the LLM output and extracts the clean subject and body strings.\n    \n\n### Stage 3: Logging and Draft\n\nThe final output is passed to **Google Sheets** for logging and status updates, and then to **Gmail (Create a draft)**, which sends the fully assembled, personalized email to the user's drafts folder for final **Quality Assurance** before sending."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "93a44ccd-e4b6-4b9b-b169-74dd390cd046",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Summarize Website",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Final Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Site": {
      "main": [
        [
          {
            "node": "Extract Text & Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Leads": {
      "main": [
        [
          {
            "node": "Filter (Qualified Leads)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Summary": {
      "main": [
        [
          {
            "node": "Generate Subject & Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a draft": {
      "main": [
        [
          {
            "node": "Loop Over Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Get All Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Leads": {
      "main": [
        [
          {
            "node": "Send Team Completion Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Capture Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output": {
      "main": [
        [
          {
            "node": "Log Final Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Final Result": {
      "main": [
        [
          {
            "node": "Create a draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture Lead Data": {
      "main": [
        [
          {
            "node": "Scrape Site",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize Website": {
      "main": [
        [
          {
            "node": "Merge Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text & Links": {
      "main": [
        [
          {
            "node": "Filter Social & Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Social & Status": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Subject & Body": {
      "main": [
        [
          {
            "node": "Parse AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter (Qualified Leads)": {
      "main": [
        [
          {
            "node": "Loop Over Leads",
            "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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Your Cold Email is Now Researched. This pipeline finds specific bottlenecks on prospect websites and instantly crafts an irresistible pitch

Source: https://n8n.io/workflows/10266/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This intelligent email automation workflow helps you maximize engagement through domain-based outreach. It utilizes AI-powered personalization and strategic follow-ups to increase response rates. The

Gmail, HTTP Request, Google Sheets +1
AI & RAG

Send a target niche and location via Telegram message Workflow discovers businesses via Google Maps API AI enriches contacts with email and LinkedIn data via Serper GPT-4o scores and qualifies each le

Telegram Trigger, OpenAI, Google Sheets +3
AI & RAG

This workflow is designed for SEO professionals, digital agencies, content creators, and WordPress site owners who want to improve their search engine rankings automatically. It’s also perfect for cur

OpenAI, Google Sheets, XML +3
AI & RAG

This n8n workflow — HRMate — streamlines your entire recruitment process by automatically parsing incoming job applications, evaluating candidate fit using AI, and sending personalized acceptance or r

HTTP Request, Gmail Trigger, OpenAI +2
AI & RAG

Overview

Gmail Trigger, Google Drive, OpenAI +4