<aside>
Goal:
Automate cold email outreach by pulling leads and templates from Supabase, personalizing each email, and sending them via Gmail.
Problem:
Manual outreach is time-consuming, prone to errors, and lacks personalization when sending to multiple leads at scale.
Solution:
A fully automated n8n workflow that fetches leads, applies random templates, personalizes messages, sends emails, and logs the status back into Supabase.
Step 1: Trigger
- Node: Manual Trigger
- Starts the workflow when testing or running manually.
Step 2: Get Leads Data
- Node: Supabase (Get many rows)
- Pulls all leads stored in the
Leads table.
Step 3: Filter by Status
- Node: IF
- Ensures only leads with
Send Status β SENT are processed.
Step 4: Loop Over Items
- Node: Split In Batches
- Iterates through each lead one by one.
Step 5: Get Email Templates
- Node: Supabase (Get many rows)
- Fetches all email templates from the
Template table.
Step 6: Random Template Selection
- Node: Code
- Picks a random template, formats the body as HTML, and prepares subject + body.
Step 7: Merge Lead with Template
- Node: Merge
- Combines lead data with the selected email template.
Step 8: Personalize Message
- Node: Edit Fields
- Replaces
[name] with the leadβs name (or βthereβ if empty).
Step 9: Send Email
- Node: Gmail
- Sends the personalized email using Gmail API.
Step 10: Log Results
- Node: Merge + Update Row (Supabase)
- Updates the
Send Status and Time for the lead in Supabase.
Step 11: Add Delay
- Node: Wait
- Adds a small pause before continuing to the next lead (avoids spam).
Tools Used:
- n8n (workflow automation)
- Supabase (database for leads + templates)
- Gmail API (send emails)
- JavaScript (template randomizer & HTML formatter)
Impact:
- Saves hours of manual outreach work.
- Ensures personalized cold emails at scale.
- Tracks and logs every interaction in Supabase.
- Flexible and reusable for multiple campaigns.
π§ Learnings:
- How to integrate Supabase with n8n for scalable workflows.
- Implementing randomization to avoid repetitive templates.
- Handling personalization logic inside automation.
- Building a complete outreach pipeline from data β message β logging.
</aside>

π Download & Explore the Workflow:
Cold Email Campaign
View GitHub Repository :
Cold-Email-Campaign-Automation-Supabase-Gmail-n8n/Cold Email Campaign.github.json at main Β· AlvLeoAI/Cold-Email-Campaign-Automation-Supabase-Gmail-n8n