🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Supabase + Mailgun: cold emails that follow up

Lisa Granqvist Partner Workflow Automation Expert

Your cold outreach starts strong. Then the follow-up slips, a lead replies and still gets nudged again, or your “sent” status lives in three places nobody trusts. It’s not laziness. It’s the reality of juggling lists, timing, and personalization by hand.

This Supabase Mailgun automation hits SDRs first, but agency owners and growth-focused founders feel it too. You get consistent 3-step sequences, follow-ups that don’t get forgotten, and tracking that’s actually tied to your source of truth (your database), not someone’s spreadsheet tab.

Below, you’ll see exactly how the workflow runs inside n8n, what it automates, the results you can expect, and the few places teams usually trip up when they launch it.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Supabase + Mailgun: cold emails that follow up

The Problem: Cold outreach breaks at the follow-up

Sending one cold email is easy. Running a reliable sequence is where things get messy. You have to track who got Email 1, who should get Email 2 today (in the right timezone), who replied, and who should be paused so you don’t look careless. And if you’re also trying to personalize at scale, you end up copying company notes into prompts, tweaking HTML, and hoping the “last contacted” field is accurate. It’s a lot of small steps. They stack up into hours each week and plenty of avoidable mistakes.

The friction compounds. Here’s where it usually breaks down.

  • Follow-ups happen late (or not at all) because they depend on someone remembering to check a list.
  • Teams accidentally double-send or follow up after a reply because the “status” isn’t connected to the sending tool.
  • Personalization stays shallow since researching every company eats about 10 minutes per lead.
  • Deliverability suffers when you blast too fast or always send from the same address.

The Solution: AI-personalized sequences sent and tracked from Supabase

This n8n workflow turns Supabase into the control center for cold outreach, with Mailgun handling delivery and AI handling the hard part: writing emails that sound like you did the homework. It starts on a schedule, pulls leads from Supabase, and checks what stage each lead is in (first touch, follow-up 1, follow-up 2, and so on). For each eligible lead, it researches company context, generates a tailored message (including well-formatted HTML and multi-language options), and sends via Mailgun using throttled batches and timed waits. After each send, it updates Supabase with send history and the next stage so your tracking stays clean. It also supports sender rotation, basic reliability safeguards, and even Telegram input for voice or text when you want to feed in new lead info quickly.

The workflow wakes up via scheduled triggers, then fetches and sorts leads. Next it evaluates timing (including timezone logic), routes each record by sequence stage, and sends the right email through Mailgun. Finally, it writes the outcome back to Supabase so the next run knows exactly what to do.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you add 50 new prospects a week to Supabase. Manually running a 3-step sequence often means about 5 minutes per lead per step (drafting, checking history, scheduling), which is roughly 12 hours weekly when you include follow-ups and status updates. With this workflow, you spend maybe 30 minutes up front reviewing the prompt and template, then each scheduled run sends and logs automatically while you’re doing other work. Most teams end up with outreach that runs daily without the daily babysitting.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Supabase to store leads, stages, and history.
  • Mailgun to send emails with good deliverability.
  • OpenAI or Anthropic API key (get it from your provider dashboard).

Skill level: Intermediate. You’ll connect credentials, confirm table fields in Supabase, and adjust prompts and scheduling settings.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

Scheduled runs pull the next set of leads. Multiple schedule triggers kick off the workflow, then Supabase queries fetch records that match your rules (new prospects, ready for follow-up, not paused).

Timing and eligibility get evaluated. The workflow computes timezone, checks conditions (like stage and last send time), sorts records, and caps volume so you don’t accidentally send too many in a single window.

AI generates messages that fit the lead. A research step gathers company and role context, then an agent composes a multi-step email sequence. The output is parsed into structured fields so it can be merged into consistent HTML templates without breaking formatting.

Mailgun sends, Supabase records the truth. Emails go out in batches with waits between cycles, and the workflow immediately updates Supabase with send timestamps, stage changes, and history so the next run picks up cleanly. If you’re feeding leads via Telegram (voice or text), that input is routed and processed before the lead enters the same pipeline.

You can easily modify scheduling windows to match your market based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Scheduled Trigger

This workflow uses multiple scheduled triggers to pull outreach candidates and timing windows.

  1. Open Scheduled Trigger A and set the schedule that should kick off the main lead fetch cycle.
  2. Open Scheduled Trigger B and set the schedule for the secondary lead evaluation pipeline.
  3. Open Scheduled Trigger C and Scheduled Trigger D to define the timing windows for send-time evaluation (these lead into Supabase Fetch B and Supabase Fetch C).

Keep these schedules staggered to avoid overlapping lead batches that could exceed sending limits.

Step 2: Connect Supabase Data Sources

Supabase powers the lead database and status updates throughout the workflow.

  1. Open Supabase Fetch A, Supabase Fetch B, Supabase Fetch C, and Retrieve Multiple Rows to configure table and query details for each dataset.
  2. Configure Leads Table Fetch to pull lead records used for timezone and sender routing.
  3. Connect updates in Supabase Update A, Supabase Update B, Supabase Update C, Supabase Update D, Supabase Update E, and Supabase Update F so each batch writes status changes back to Supabase.
  4. Set Insert New Leads to insert records identified by the scraping pipeline.
  5. Credential Required: Connect your Supabase credentials on all Supabase nodes (12+ nodes handle fetch, update, and insert actions).

⚠️ Common Pitfall: Missing Supabase credentials will cause silent failures downstream because many nodes rely on fetched data.

Step 3: Set Up Lead Filtering and Routing Logic

Leads are filtered, sorted, and staged before emails are dispatched.

  1. Review Check Condition A, Check Condition B, Check Condition C, and Check Condition D to confirm branching rules and pass/stop logic.
  2. Confirm the order in Sort Records A, Sort Records B, Sort Records C, and Sort Records D so priority leads are processed first.
  3. Apply caps in Apply Record Cap, Apply Record Cap B, Apply Record Cap C, Apply Record Cap D, and Apply Record Cap E to avoid sending too many emails per cycle.
  4. Set stage routing in Route by Stage, Route by Stage B, and Route by Stage C to send each lead into the correct batch path.
  5. Note that Placeholder Step, Placeholder Step B, Placeholder Step C, and Placeholder Step D are no-op nodes kept for debugging and future expansion.

Apply Record Cap outputs to both Combine Streams and Research Company Info in parallel—this is intentional to enrich leads while preparing the outbound sequence.

Step 4: Configure AI Research and Email Composition

AI nodes generate research insights and craft the outreach sequence.

  1. Open Research Company Info and General Analysis to define prompts and inputs that analyze lead companies.
  2. Open Compose Email Sequence to define the agent prompt for multi-step outreach messages.
  3. Ensure OpenAI Chat Engine is connected as the language model for Compose Email Sequence and add credentials there.
  4. Use Transform Script A and Combine Streams to align AI outputs with lead data before timezone logic.
  5. Credential Required: Connect your OpenAI credentials on Research Company Info, General Analysis, Compose Email Sequence, OpenAI Chat Engine, and Transcribe Audio.

Structured Parser A and Structured Parser B are AI sub-nodes. Add credentials on the parent nodes (for example, Compose Email Sequence or Web Scraper Agent), not directly on the parser nodes.

Step 5: Configure Web Scraping and Lead Enrichment

This section scrapes and validates new lead emails using agents, Apify, and Postgres.

  1. Set up Web Scraper Agent with its prompt and input fields so it can interpret the text payloads from Set Text Payload and Transcribe Audio.
  2. Web Scraper Agent outputs to both Build Query Payload and Fetch Scraped Emails in parallel, enabling simultaneous query building and existing email retrieval.
  3. Configure Build Query PayloadBuild Request URLRun Apify Actor to generate scrape requests.
  4. Confirm Extract Details, Filter Verified Emails, and Filter New Leads correctly extract and validate data before insertion.
  5. Credential Required: Connect your Apify credentials in Run Apify Actor.
  6. Credential Required: Connect your Postgres credentials in Fetch Scraped Emails.

Use Already Processed to quickly test comparison logic by routing duplicates into a no-op branch.

Step 6: Configure Telegram Intake and Notifications

Telegram handles inbound voice/text prompts and outbound confirmation notices.

  1. Configure Telegram Incoming to listen for inbound messages and connect it to Route Voice or Text.
  2. Set Route Voice or Text to send audio to Download Attachment and text to Set Text Payload.
  3. Connect Download Attachment to Transcribe Audio so voice prompts become text inputs for Web Scraper Agent.
  4. Configure Compose Telegram NoticeApply Record Cap ESend Telegram Confirm for completion notifications.
  5. Credential Required: Connect your Telegram credentials on Telegram Incoming, Download Attachment, and Send Telegram Confirm.

⚠️ Common Pitfall: If Telegram credentials are missing, the scraping pipeline will never start when triggered by chat messages.

Step 7: Configure Timezone and Sender Selection

Timezone logic and sender selection align outreach timing with recipient regions.

  1. Review Compute Timezone and Determine Sender Address to ensure the code aligns with your data fields.
  2. Confirm Determine Sender Address outputs correctly to Leads Table Fetch so sender details are applied per lead.
  3. Use Evaluate Send Time A and Evaluate Send Time B to compute per-lead send windows before Check Condition C and Check Condition D.

Keep timezone conversions consistent in Compute Timezone to avoid sending outside local business hours.

Step 8: Configure Email Dispatch and Sequencing

Emails are sent through multiple stages with delays and batch iteration.

  1. Connect your Mailgun account in Dispatch Email A, Dispatch Email B, Dispatch Email C, Dispatch Email D, Dispatch Email E, and Dispatch Email F.
  2. Ensure each email dispatch node sends to its paired delay: for example, Dispatch Email BDelay Cycle A and Dispatch Email ADelay Cycle B.
  3. Configure Delay Cycle A through Delay Cycle F to match your desired follow-up cadence.
  4. Verify batch routing from Batch Iterate A through Batch Iterate F to respective Supabase updates and email dispatches.
  5. Credential Required: Connect your Mailgun credentials on all Mailgun nodes (6 nodes handle the full sequence).

⚠️ Common Pitfall: If any delay node is misconfigured, batches will stall and later emails will never send.

Step 9: Configure AI Memory and Parsing Tools

AI tools enhance the scraping and generation pipelines with memory and structured outputs.

  1. Review Memory Buffer to ensure it is attached to Web Scraper Agent via the AI memory connection.
  2. Enable Structured Parser B for the scraping pipeline if you want structured output; it connects to Web Scraper Agent.
  3. Note that Structured Parser A is disabled; enable it only if your email composition pipeline requires structured parsing.
  4. Ensure OpenAI Chat Engine B is connected to Web Scraper Agent as its language model.
  5. Credential Required: Add OpenAI credentials to OpenAI Chat Engine B (AI sub-nodes like Memory Buffer and parsers use the parent node credentials).

Step 10: Test & Activate Your Workflow

Validate each pipeline path before turning the system on.

  1. Manually execute Scheduled Trigger A and confirm that data flows from Supabase Fetch A to Dispatch Email nodes with appropriate delays.
  2. Trigger Telegram Incoming with a test voice note and confirm it passes through Download AttachmentTranscribe AudioWeb Scraper Agent.
  3. Verify that new leads pass Filter Verified Emails and Filter New Leads, then land in Insert New Leads with a confirmation sent by Send Telegram Confirm.
  4. A successful run should show updates in Supabase Update A through Supabase Update F, and each email node should emit a successful response.
  5. When satisfied, toggle the workflow to Active to enable scheduled production runs.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Mailgun credentials can expire or need specific permissions. If things break, check your Mailgun API key status and sending domain verification first.
  • If you’re using Wait nodes or external processing, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this Supabase Mailgun automation automation?

Plan on about 60 minutes if your Supabase tables and Mailgun domain are ready.

Do I need coding skills to automate Supabase Mailgun automation?

No. You’ll mainly connect accounts and edit a few prompts and schedule settings.

Is n8n free to use for this Supabase Mailgun automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI or Anthropic API costs, plus Mailgun sending costs.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this Supabase Mailgun automation workflow for different send days and languages?

Yes, and it’s one of the best reasons to use this template. You’ll adjust the scheduled triggers and the “evaluate send time” logic to match your preferred days and hours, then update the AI prompt used to compose the sequence for your language and tone. If you prefer a different research source, you can swap the scraping/research portion (the HTTP request/agent step) while keeping the Supabase stage routing and Mailgun dispatch intact. Common tweaks are changing the number of follow-ups, setting different delays, and adding a “do-not-email” rule for certain segments.

Why is my Mailgun connection failing in this workflow?

Usually it’s an API key or domain issue. Regenerate your Mailgun API key, confirm your sending domain is verified, and make sure the “from” address the workflow selects is allowed on your account. If you enabled sender rotation, also confirm every sender identity exists in Mailgun. Rate limits can show up too when you try to push a big batch at once.

How many leads can this Supabase Mailgun automation automation handle?

A lot, as long as you batch it. On n8n Cloud Starter, you’re limited by monthly executions, while self-hosting mostly depends on your server and how aggressively you send through Mailgun.

Is this Supabase Mailgun automation automation better than using Zapier or Make?

Often, yes, because sequences need branching, timing, and state tracking. n8n makes it practical to do record caps, batching, waits, and “route by stage” logic without paying extra every time the path gets complex. It also lets you keep data updates tightly coupled to the send action, which reduces “sent but not logged” gaps. Zapier or Make can still work for simpler outreach, like one email per trigger with a single follow-up. If your sequence logic is already a bit of a beast, this workflow will feel more stable. Talk to an automation expert if you’re not sure which fits.

Once this is running, follow-ups stop being a daily chore and start being a system. You’ll notice the calm immediately, honestly.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal