AI-Driven Cold Email Personalization with Gemini, Supabase & Smartlead - n8n Workflow

Use this advanced n8n workflow to profile leads using Google Gemini AI, qualify them based on score, and generate ultra-personalized, deliverability-optimized cold emails before pushing them to Smartlead.

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 technologists managing complex outreach campaigns.
Agencies building hyper-personalized lead generation systems.
Anyone interested in creating custom n8n templates for AI-powered sales.

Overview

Traditional cold emailing often fails due to a lack of genuine personalization and poor deliverability. This sophisticated n8n workflow solves this by utilizing Google Gemini's advanced reasoning capabilities to deeply analyze lead data (LinkedIn posts, company details, etc.) stored in Supabase. The system moves beyond simple mail merge to create a detailed 'Psychological Profile' of the prospect. It then generates a lead qualification score, ensuring only high-potential leads (score > 40) proceed. Finally, the n8n node dedicated to copywriting generates highly optimized, ultra-short email sequences designed for maximum deliverability and response, leveraging the detailed profile data before syncing everything into a Smartlead campaign. This n8n automation turns raw data into actionable, hyper-personalized sales collateral.

How it Works

The entire process is initiated by an n8n trigger: the Schedule Trigger. This trigger periodically starts the n8n workflow.


  1. Data Retrieval: The workflow first queries the Supabase database using the Supabase n8n node to retrieve all necessary lead data.

  2. AI Profiling (Stage 1): The data is passed to a Basic LLM Chain node, powered by Google Gemini, acting as a 'Digital Detective'. This chain compiles all available information into a detailed psychological and professional profile, focusing on communication style and pain points.

  3. Supabase Update: The resulting 'LEAD PROFILING' intelligence is saved back into the lead's Supabase row using an Update n8n node.

  4. AI Qualification (Stage 2): A second Basic LLM Chain node uses the profile to assign an 'Overall Score' (1-100) and a qualification verdict (HOT/WARM/NOT QUALIFIED) based on detailed criteria (Decision-Maker Fit, Business Need, etc.). This data is extracted and also saved back to Supabase.

  5. Filtering: A Code n8n node prepares the score, and an If n8n node filters out leads scoring below 40, preventing expensive and irrelevant outreach.

  6. AI Copywriting (Stage 3): For qualified leads, a third Basic LLM Chain generates two ultra-short, highly specific emails (Email 1 and Follow-up 2), adhering to strict deliverability rules (e.g., maximum 60 words, conversational subject lines). The output is extracted and stored in Supabase via another Update n8n node.

  7. Campaign Deployment: Finally, the n8n workflow uses HTTP Request nodes to communicate with Smartlead. It creates a new Smartlead campaign and then adds the fully enriched leads, passing the AI-generated personalized email subjects and bodies as custom fields, ready for launch.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import: Copy the entire JSON code and import it into your n8n instance via the 'Workflows' menu.

  2. Supabase Credentials: Set up your Supabase credentials. Ensure the connection ID matches the workflow requirements and verify that your 'Leads' table schema includes fields for 'E-mail', 'First Name', 'Overall Score', 'LEAD PROFILING', and all 'email 1/2' fields used for storage.

  3. Google Gemini Credentials: Configure the Google Gemini (or PaLM) API credentials used by the Language Model n8n node chains. This is critical for the AI processing steps.

  4. Smartlead Setup: Modify the two HTTP Request n8n node steps (smatlead-create-campaign and smartlead-add-leads-to-campaign). Replace your-api-key in the URL parameters with your actual Smartlead API key.

  5. Review Mappings: Check the data mappings in the Smartlead HTTP Request node to ensure custom fields align perfectly with how Smartlead expects to receive the personalized email copy.

  6. Activate: Enable the Schedule n8n trigger and activate the n8n workflow.

Node Details

Schedule Trigger (n8n trigger): The starting n8n node, set to run the entire n8n workflow on a predetermined schedule, ensuring continuous lead processing.
Supabase (Get many rows & Update a row): This n8n node handles all persistence, pulling raw lead data and storing the AI-generated 'LEAD PROFILING', 'Overall Score', and final personalized email copy.
Basic LLM Chain (Gemini): Three separate instances of this n8n node are used (LLM Chains 5, 6, and 7), each configured with highly specialized prompts (Digital Detective, Lead Qualification Engine, and Deliverability Mastery Copywriter) to perform complex analysis and generation tasks using the Google Gemini models.
Information Extractor: These n8n nodes are essential for converting the structured text output from the LLM chains into structured JSON data, making the scores and email components easily usable by subsequent n8n nodes.
Code: A crucial n8n node used to dynamically process the Lead Score, ensuring a minimum threshold is available for the filter and handling various input formats.
If: This flow control n8n node acts as a quality gate, ensuring that the cold email generation only runs for leads that surpass the qualification threshold (score > 40).


  • HTTP Request (Smartlead): These nodes manage the final deployment. They create the marketing campaign and use the lead data, now enriched with all personalized fields from the n8n workflow, to add prospects directly into the Smartlead outreach sequence.

Related n8n Workflows

Free

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

AI and Automation Consultant with over 1000 hours of experience building, deploying, and solving marketing and sales automation problems. I ship AI products faster by combining business acumen with AI & automation expertise and an engineering mindset. Connect with me on LinkedIn to chat.

Featured*