Hyper-Personalized Sales Email Generation using LinkedIn Data and Claude 3.7 - n8n Workflow

Use this powerful n8n workflow template to automate cold outreach. Scrape LinkedIn profiles via Apify, enrich data, and generate highly personalized emails using the Claude 3.7 LLM via the OpenRouter n8n node, then send automatically via Gmail.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Sales Development Representatives (SDRs) and BDRs looking to scale personalization.

  • Marketing automation specialists needing advanced AI-driven outbound campaigns.

  • Business owners seeking to leverage LinkedIn data for targeted outreach.

  • Users interested in complex multi-step n8n workflow examples integrating LLMs (Large Language Models) and web scraping.

Overview

Generating truly personalized cold emails at scale is a significant challenge. Generic outreach leads to low conversion rates. This comprehensive n8n workflow solves this by providing the AI with detailed, specific context about the recipient and their company, ensuring every email is unique and highly relevant.

The automation starts by fetching a list of leads from Google Sheets. For each lead, the n8n workflow performs a sequence of web scraping and data enrichment steps using Apify to retrieve LinkedIn profile and company data. This rich, structured data—including job history, skills, and company specialties—is then fed into the Langchain n8n node, powered by Claude 3.7 (via OpenRouter). The prompt is engineered to generate witty, concise, and highly personalized emails following strict sales guidelines. Finally, the resulting email is automatically sent via a Gmail n8n node, dramatically increasing the efficiency and effectiveness of your outbound sales efforts. This is a powerful demonstration of what a sophisticated n8n template can achieve.

How it Works

This n8n workflow operates in a distinct, linear fashion, processing one lead at a time:


  1. Trigger and Data Ingestion: The n8n workflow is manually initiated and the 'Get Leads' Google Sheets n8n node pulls the target list (First Name, Last Name, Company, Email) from a specified spreadsheet.

  2. Looping: The 'Loop Over Items' n8n node ensures that subsequent steps are executed individually for every lead retrieved from the sheet.

  3. Person Data Enrichment: The workflow initiates a Google search for the person's LinkedIn profile using an HTTP Request n8n node (leveraging an Apify endpoint). The 'Only People Links' n8n node filters the results to retain only valid LinkedIn profile URLs via regex matching.

  4. Scraping Person Profile: The 'Get LinkedIn Person' HTTP Request n8n node then uses this URL to scrape detailed profile information (bio, experience, education, etc.).

  5. Company URL Determination: An IF n8n node checks if the company URL was already present in the person's profile data. If not, a separate Google search for the company LinkedIn profile is executed, filtered, and aggregated.

  6. Scraping Company Profile: The 'Get LinkedIn Company' HTTP Request n8n node retrieves comprehensive company details (description, specialties, employee count).

  7. System Setup: The 'Set Data' n8n node injects static business context (company name, sender email, and a detailed pitch/info about your services) for the AI.

  8. AI Email Generation: The 'Generate Personalized Email' Langchain n8n node receives the massive JSON context containing all LinkedIn data and the system pitch. It uses the Anthropic Claude-3.7-Sonnet model, accessed through the OpenRouter n8n node, to draft a personalized email based on complex instructions (e.g., acting as 'Dolly, the AI stand-up comedian').

  9. Output Formatting: The 'Structured Output Parser' n8n node validates and extracts the 'subject' and 'body' from the AI's JSON output.

  10. Delivery: The final 'Gmail' n8n node sends the personalized email to the target recipient, completing the cycle for that specific lead.

Installation Guide

To deploy and utilize this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it directly into your n8n canvas via the 'New' > 'Import from JSON' option.

  2. Google Sheets Credential: Configure the 'Get Leads' n8n node. You will need a Google Sheets OAuth2 credential linked to the spreadsheet containing your lead data (columns required: First Name, Last Name, Company, Email).

  3. Apify/HTTP Header Credential: The workflow relies on Apify for web scraping. You must set up a generic HTTP Header Auth credential named 'Header Auth account' (or update the credential reference in all HTTP Request n8n nodes) containing your Apify API key.

  4. OpenRouter Credential: Set up an OpenRouter API credential and link it to the 'OpenRouter Chat Model' n8n node. This allows the n8n workflow to access the Claude 3.7 model.

  5. Gmail Credential: Configure the 'Gmail' n8n node with your sending email account credentials.

  6. Customize Sender Data: Crucially, modify the 'Set Data' n8n node parameters to include your actual companyname, emailaddress, sendername, and detailed companyinfo. This information is vital for the AI's personalization context.

  7. Test: Execute the n8n trigger manually to ensure the flow runs correctly before processing large batches.

Node Details

Manual Trigger (When clicking ‘Execute workflow’): The starting n8n node, initiating the data pull.
Google Sheets (Get Leads): Function: Reads lead data from a defined spreadsheet, serving as the input for the entire process. Key Configuration: Document ID and Sheet Name (e.g., 'Leads / Unprocessed').
Split In Batches (Loop Over Items): Function: Ensures each lead item is processed sequentially through the complex enrichment and AI steps.
HTTP Request (Google Search for Person/Company LinkedIn): Function: Uses Apify's RAG Web Browser service to perform highly specific Google searches aimed at finding exact LinkedIn URLs. Key Configuration: Uses templated expressions like ${$json['First Name']} ${$json['Last Name']} ${$json['Company']} site:linkedin.com.
Filter (Only People/Company Links): Function: Filters search results using regular expressions to strictly ensure only valid LinkedIn profile or company URLs are passed to the scraping step. This is a critical logic n8n node.
HTTP Request (Get LinkedIn Person/Company): Function: Uses specialized Apify endpoints (linkedin-profile-detail and linkedin-company-detail) to scrape deep, structured JSON data about the target person and their company.
IF (Current Company Exists?): Function: A core logic n8n node that branches the workflow based on whether the person's scraped data already contains a direct company URL, minimizing unnecessary searches.
Set (Set Data): Function: Injects mandatory business context, sender details, and the detailed company pitch into the workflow data stream, providing the LLM with all necessary information.
Chain LLM (Generate Personalized Email): Function: The central intelligence n8n node. It combines all gathered data (LinkedIn JSON, business pitch) and the extensive AI persona prompt to generate the email content. Key Configuration: Uses Anthropic/Claude-3.7-Sonnet via OpenRouter.
Structured Output Parser: Function: Parses the structured JSON output from the LLM, making the subject and body directly accessible to the final Gmail n8n node.


  • Gmail: Function: Sends the generated email to the lead. Key Configuration: Subject and Message fields dynamically reference the output from the AI parser (e.g., {{ $json.output.subject }}). This finalizes the n8n workflow's execution.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

I am a product-minded technologist with hacker DNA building things in AI automation. I have a broad and varied background - having worked in Product, Design, and Sales - combined with deep technical experience as a Senior Developer and Fractional CTO. I am also a best-selling Udemy instructor (with 25K+ students), and founder of WOOFCODE - a free coding camp for fullstack developers. I practice non-violent communication, motivational interviewing, and Tibetan Buddhist meditation.

Featured*