Mailgun + Gmail: outbound sent, replies drafted
Outbound breaks in the boring places. A lead replies, your CRM isn’t updated, the thread gets missed, and suddenly the “simple follow-up” turns into a messy, manual chase.
This Gmail reply drafts automation hits SDRs first, honestly. But founders running their own outreach and agency leads juggling multiple campaigns feel the same friction. You get consistent follow-ups without giving up human review.
You’ll see how this workflow sends personalized sequences through Mailgun, watches for Gmail replies from known contacts, then drafts ready-to-send responses while keeping your lead status current.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Mailgun + Gmail: outbound sent, replies drafted
flowchart LR
subgraph sg0["User message Flow"]
direction LR
n63["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Create URL"]
n64@{ icon: "mdi:swap-vertical", form: "rounded", label: "Extract Info", pos: "b", h: 48 }
n65@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Only Keep Verified Emails ", pos: "b", h: 48 }
n66["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Download File1"]
n67@{ icon: "mdi:robot", form: "rounded", label: "Transcribe1", pos: "b", h: 48 }
n68@{ icon: "mdi:swap-vertical", form: "rounded", label: "Text1", pos: "b", h: 48 }
n69@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Voice or Text1", pos: "b", h: 48 }
n70@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model1", pos: "b", h: 48 }
n71@{ icon: "mdi:memory", form: "rounded", label: "Simple Memory", pos: "b", h: 48 }
n72["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Select already scraped mails"]
n73["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/compare.svg' width='40' height='40' /></div><br/>Keep only the new leads"]
n74@{ icon: "mdi:cog", form: "rounded", label: "Already scraped", pos: "b", h: 48 }
n75["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Create rows with new leads"]
n76@{ icon: "mdi:swap-vertical", form: "rounded", label: "Set Telegram message", pos: "b", h: 48 }
n77["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Confirmation message"]
n78["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>User message"]
n79@{ icon: "mdi:swap-vertical", form: "rounded", label: "Generate query payload", pos: "b", h: 48 }
n80@{ icon: "mdi:robot", form: "rounded", label: "Scraper agent", pos: "b", h: 48 }
n81@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Run an Actor", pos: "b", h: 48 }
n82@{ icon: "mdi:cog", form: "rounded", label: "Limit3", pos: "b", h: 48 }
n83@{ icon: "mdi:robot", form: "rounded", label: "Structured Output Parser1", pos: "b", h: 48 }
n68 --> n80
n82 --> n77
n63 --> n81
n67 --> n80
n64 --> n65
n81 --> n64
n78 --> n69
n80 --> n79
n80 --> n72
n71 -.-> n80
n66 --> n67
n69 --> n66
n69 --> n68
n70 -.-> n80
n76 --> n82
n79 --> n63
n73 --> n74
n73 --> n75
n83 -.-> n80
n75 --> n76
n65 --> n73
n72 --> n73
end
subgraph sg1["Schedule Flow"]
direction LR
n25["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase11"]
n26@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If1", pos: "b", h: 48 }
n27["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Evualute when the mail was s.."]
n28@{ icon: "mdi:cog", form: "rounded", label: "Sort", pos: "b", h: 48 }
n31@{ icon: "mdi:cog", form: "rounded", label: "Limit2", pos: "b", h: 48 }
n32@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch5", pos: "b", h: 48 }
n33@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items7", pos: "b", h: 48 }
n34@{ icon: "mdi:cog", form: "rounded", label: "Wait7", pos: "b", h: 48 }
n35@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items10", pos: "b", h: 48 }
n36@{ icon: "mdi:cog", form: "rounded", label: "Wait10", pos: "b", h: 48 }
n37["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mailgun.svg' width='40' height='40' /></div><br/>Mailgun6"]
n38["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mailgun.svg' width='40' height='40' /></div><br/>Mailgun7"]
n39["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase12"]
n40["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase14"]
n41@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger4", pos: "b", h: 48 }
n42@{ icon: "mdi:cog", form: "rounded", label: "No Operation, do nothing1", pos: "b", h: 48 }
n26 --> n28
n26 --> n42
n28 --> n31
n34 --> n33
n31 --> n32
n36 --> n35
n32 --> n33
n32 --> n35
n37 --> n36
n38 --> n34
n25 --> n27
n33 --> n39
n33 --> n38
n35 --> n40
n35 --> n37
n41 --> n25
n27 --> n26
end
subgraph sg2["Schedule Flow"]
direction LR
n43["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase13"]
n44@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If", pos: "b", h: 48 }
n45["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Evualute when the mail was s.."]
n46@{ icon: "mdi:cog", form: "rounded", label: "Sort3", pos: "b", h: 48 }
n47@{ icon: "mdi:cog", form: "rounded", label: "Limit4", pos: "b", h: 48 }
n48@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch6", pos: "b", h: 48 }
n49@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items8", pos: "b", h: 48 }
n50@{ icon: "mdi:cog", form: "rounded", label: "Wait8", pos: "b", h: 48 }
n51@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items11", pos: "b", h: 48 }
n52@{ icon: "mdi:cog", form: "rounded", label: "Wait11", pos: "b", h: 48 }
n53["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mailgun.svg' width='40' height='40' /></div><br/>Mailgun8"]
n54["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mailgun.svg' width='40' height='40' /></div><br/>Mailgun9"]
n55["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase15"]
n56["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase16"]
n57@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger6", pos: "b", h: 48 }
n58@{ icon: "mdi:cog", form: "rounded", label: "No Operation, do nothing4", pos: "b", h: 48 }
n44 --> n46
n44 --> n58
n46 --> n47
n50 --> n49
n47 --> n48
n52 --> n51
n48 --> n49
n48 --> n51
n53 --> n52
n54 --> n50
n43 --> n45
n49 --> n55
n49 --> n54
n51 --> n56
n51 --> n53
n57 --> n43
n45 --> n44
end
subgraph sg3["Schedule Flow"]
direction LR
n0@{ icon: "mdi:cog", form: "rounded", label: "Limit", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge"]
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Time Zone"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Sender Email"]
n10@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If3", pos: "b", h: 48 }
n13@{ icon: "mdi:robot", form: "rounded", label: "General anlysis", pos: "b", h: 48 }
n15@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n16@{ icon: "mdi:cog", form: "rounded", label: "No Operation, do nothing", pos: "b", h: 48 }
n23["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code"]
n24@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger3", pos: "b", h: 48 }
n29@{ icon: "mdi:cog", form: "rounded", label: "Sort1", pos: "b", h: 48 }
n59@{ icon: "mdi:robot", form: "rounded", label: "research about company", pos: "b", h: 48 }
n60@{ icon: "mdi:robot", form: "rounded", label: "create email sequence", pos: "b", h: 48 }
n61["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Get many rows"]
n62["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Your leads table"]
n10 --> n29
n10 --> n16
n23 --> n1
n0 --> n1
n0 --> n59
n1 --> n2
n29 --> n0
n2 --> n3
n3 --> n62
n61 --> n10
n13 --> n60
n15 -.-> n60
n24 --> n61
n60 --> n23
n59 --> n13
end
subgraph sg4["Schedule Flow"]
direction LR
n4@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch", pos: "b", h: 48 }
n5@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items", pos: "b", h: 48 }
n6@{ icon: "mdi:cog", form: "rounded", label: "Wait", pos: "b", h: 48 }
n7@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items1", pos: "b", h: 48 }
n8@{ icon: "mdi:cog", form: "rounded", label: "Wait1", pos: "b", h: 48 }
n9@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger1", pos: "b", h: 48 }
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mailgun.svg' width='40' height='40' /></div><br/>Mailgun"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mailgun.svg' width='40' height='40' /></div><br/>Mailgun1"]
n14@{ icon: "mdi:cog", form: "rounded", label: "Limit1", pos: "b", h: 48 }
n17["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase2"]
n18@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If2", pos: "b", h: 48 }
n19@{ icon: "mdi:cog", form: "rounded", label: "No Operation, do nothing2", pos: "b", h: 48 }
n20["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase3"]
n21["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/supabase.svg' width='40' height='40' /></div><br/>Supabase4"]
n30@{ icon: "mdi:cog", form: "rounded", label: "Sort2", pos: "b", h: 48 }
n18 --> n14
n18 --> n19
n6 --> n5
n30 --> n18
n8 --> n7
n14 --> n4
n4 --> n5
n4 --> n7
n11 --> n8
n12 --> n6
n17 --> n30
n5 --> n20
n5 --> n12
n7 --> n21
n7 --> n11
n9 --> n17
end
subgraph sg5["Gmail Flow"]
direction LR
n84@{ icon: "mdi:play-circle", form: "rounded", label: "Gmail Trigger", pos: "b", h: 48 }
n85@{ icon: "mdi:message-outline", form: "rounded", label: "Get a message", pos: "b", h: 48 }
n86["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Execute a SQL query"]
n87["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Set replied = Yes "]
n88@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Only from email campaigns", pos: "b", h: 48 }
n89["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>extract email"]
n90@{ icon: "mdi:message-outline", form: "rounded", label: "Get Email History", pos: "b", h: 48 }
n91@{ icon: "mdi:message-outline", form: "rounded", label: "Check Sent History", pos: "b", h: 48 }
n92@{ icon: "mdi:robot", form: "rounded", label: "Email Response Parser", pos: "b", h: 48 }
n93@{ icon: "mdi:robot", form: "rounded", label: "Professional Email Response ..", pos: "b", h: 48 }
n94@{ icon: "mdi:message-outline", form: "rounded", label: "Create Draft Response", pos: "b", h: 48 }
n95@{ icon: "mdi:brain", form: "rounded", label: "Anthropic Chat Model1", pos: "b", h: 48 }
n85 --> n93
n84 --> n89
n89 --> n86
n90 -.-> n93
n91 -.-> n93
n87 --> n85
n86 --> n88
n95 -.-> n93
n92 -.-> n93
n88 --> n87
n93 --> n94
end
subgraph sg6["Structured Output Pa Flow"]
direction LR
n22@{ icon: "mdi:robot", form: "rounded", label: "Structured Output Parser", pos: "b", h: 48 }
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n78,n41,n57,n24,n9,n84 trigger
class n67,n80,n83,n13,n59,n60,n92,n93,n22 ai
class n70,n15,n95 aiModel
class n71 ai
class n65,n69,n81,n26,n32,n44,n48,n10,n4,n18,n88 decision
class n72,n86,n87 database
class n63,n27,n45,n2,n3,n23,n89 code
class n22 disabled
classDef customIcon fill:none,stroke:none
class n63,n66,n72,n73,n75,n77,n78,n25,n27,n37,n38,n39,n40,n43,n45,n53,n54,n55,n56,n1,n2,n3,n23,n61,n62,n11,n12,n17,n20,n21,n86,n87,n89 customIcon
Why This Matters: Replies Slip Through and Revenue Leaks
Outbound isn’t hard because sending is hard. It’s hard because you’re operating a mini system: timing, personalization, status updates, routing, and response handling. When that system lives in someone’s memory (or a half-updated spreadsheet), the cracks show fast. Replies arrive at the worst time, threads get buried in Gmail, and the “we’ll respond today” promise turns into tomorrow. Meanwhile you’ve got no clean view of who replied, who bounced, and who needs a second touch.
The friction compounds. Here’s where it breaks down in real teams.
- You end up copying lead context into email replies, which slows you down and makes tone inconsistent.
- Status updates happen after the fact, so reporting is always a step behind reality.
- Sequences keep sending to people who already replied because the “stop” signal isn’t automated.
- When multiple people share an inbox, ownership gets fuzzy and good replies go stale.
What You’ll Build: Mailgun Sequences + Gmail Reply Drafting
This workflow is a three-part pipeline that behaves like a lightweight outbound engine. On a schedule, it pulls leads from your database (Supabase/Postgres) and sends personalized outreach sequences through Mailgun. As emails go out, the workflow logs what happened so you always know which step a lead is on. Then, when a lead replies in Gmail, the workflow checks that the sender matches a contact in your database, pulls thread history for context, and uses AI (OpenAI/Anthropic) to classify intent and draft a reply. Instead of auto-sending, it creates a Gmail draft so you can review and approve before anything goes out.
The workflow starts with scheduled outreach runs and controlled throttling (batching plus waits) so deliverability doesn’t get wrecked. In parallel, a Gmail listener handles inbound replies, updates lead status, and generates a clean, on-brand draft response that’s already grounded in the thread history.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you run 200 outbound emails a day across a 3-step sequence and you get 10 replies. Manually, you might spend about 2 minutes logging activity per reply and another 6 minutes reading context and drafting, which is roughly 80 minutes just on response handling. With this workflow, replies get matched to the right lead automatically and a draft shows up in Gmail in a few minutes. You still review and send, but the “blank page” time mostly disappears.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Mailgun for sending your outbound sequences.
- Gmail to detect replies and create drafts.
- OpenAI or Anthropic API key (get it from your model provider dashboard).
Skill level: Intermediate. You’ll connect credentials, map a few fields, and understand where your lead data lives.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
Scheduled outreach runs. On a schedule, the workflow fetches leads from your Supabase/Postgres tables, sorts and caps the batch size, then routes leads into the right sequence step based on their current status.
Paced sending through Mailgun. Emails are dispatched via Mailgun nodes in split batches, with wait periods between sends. That pacing is there for a reason: it keeps volume controlled and makes failures easier to retry without blasting duplicates.
Reply detection in Gmail. A Gmail trigger listens for new inbound messages, extracts the sender address, checks it against your campaign and database records, and marks the lead as replied in Postgres so the sequence can stop.
AI drafts with context. The workflow pulls the thread history, runs structured parsing and intent classification (OpenAI/Anthropic), then generates a reply draft and saves it as a Gmail draft. You review, tweak if needed, and hit send.
You can easily modify the draft tone and classification labels to match your sales process. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Scheduled Triggers
This workflow uses multiple schedule-based entry points to fetch and process outreach data at different intervals.
- Open Scheduled Trigger A and set your desired schedule for initial lead fetching.
- Open Scheduled Trigger B and configure a schedule for pull-based outreach sequence generation.
- Open Scheduled Trigger C and set timing for send-time evaluation.
- Open Scheduled Trigger D and set timing for the secondary send-time evaluation stream.
Step 2: Connect Supabase Data Sources
Supabase is the core data source for leads, campaign state, and updates. Multiple Supabase nodes handle reads and writes.
- Open Supabase Fetch A, Supabase Fetch B, Supabase Fetch C, and Retrieve Many Rows, then connect credentials and set your table/query settings.
- Open Leads Table Lookup and map the lookup fields used for lead matching.
- Open all update/insert nodes (Supabase Update A through Supabase Update F, plus Insert New Leads) and ensure the correct table and field mappings.
- Credential Required: Connect your Supabase credentials to all Supabase nodes (12+ nodes across fetch, lookup, insert, and update steps).
Step 3: Set Up AI/LLM Processing
AI nodes generate research, analyze leads, draft sequences, and assist with scraping and replies. Ensure language models and parsers are connected correctly.
- Open Company Research and General Analysis, then connect OpenAI credentials for each OpenAI node.
- Open Compose Email Sequence and confirm OpenAI Chat Core is connected as the language model; add OpenAI credentials to OpenAI Chat Core.
- Open Scraping Agent and confirm OpenAI Chat Assist is connected; add OpenAI credentials to OpenAI Chat Assist.
- Open Draft Response Agent and ensure Anthropic Chat Core is connected as the language model; add Anthropic credentials to Anthropic Chat Core.
- For AI tools/sub-nodes like Structured Parser A, Structured Parser B, Parse Email Response, Retrieve Email History, Review Sent History, and Buffer Memory, add credentials to the parent nodes (Compose Email Sequence, Scraping Agent, or Draft Response Agent), not the sub-nodes.
- Credential Required: Connect your OpenAI credentials to Company Research, General Analysis, OpenAI Chat Core, OpenAI Chat Assist, and Audio Transcription.
- Credential Required: Connect your Anthropic credentials to Anthropic Chat Core.
Step 4: Configure Lead Enrichment & Scraping Flow
This path builds queries, runs Apify scraping, validates emails, and inserts new leads.
- Open Detect Voice or Text and verify the routing to Telegram File Download and Set Text Payload.
- Open Telegram File Download and Telegram User Trigger, then connect Telegram credentials.
- Open Generate URL and Run Apify Actor to set the actor and input schema.
- Confirm Scraping Agent outputs to both Build Query Payload and Fetch Scraped Emails in parallel.
- Open Fetch Scraped Emails, Run SQL Query, and Mark Replied Yes to connect PostgreSQL credentials.
- Credential Required: Connect your Apify credentials in Run Apify Actor.
- Credential Required: Connect your PostgreSQL credentials in Fetch Scraped Emails, Run SQL Query, and Mark Replied Yes.
Step 5: Configure Routing, Batching, and Send-Time Logic
Sorting, routing, and batching nodes determine how outreach sequences are throttled and scheduled.
- Verify that Branch Check A, Branch Check B, Branch Check C, and Branch Check D route to the correct sort or utility nodes.
- Review Sort Records A through Sort Records D and the limit nodes Cap Records, Cap Records B, Cap Records C, Cap Records D, and Cap Records E to confirm volume caps.
- Confirm Cap Records outputs to both Combine Streams and Company Research in parallel.
- Open Route by Case, Route by Case B, and Route by Case C to ensure each case routes into the correct batch node.
- Review all batching and delay nodes (Iterate Batch A–Iterate Batch F and Pause A–Pause F) to align send pacing.
Step 6: Configure Email Dispatch & Updates
Mailgun handles outbound email sending, while Supabase updates track results.
- Open Mailgun Dispatch A through Mailgun Dispatch F and connect your Mailgun credentials.
- Verify each Iterate Batch node outputs to both the appropriate Supabase Update node and its corresponding Mailgun Dispatch node.
- Confirm Timezone Builder and Sender Address produce the expected fields before Leads Table Lookup.
- Credential Required: Connect your Mailgun credentials to all Mailgun nodes (6 nodes).
Step 7: Configure Reply Handling & Draft Creation
Incoming replies are parsed and used to draft responses in Gmail.
- Open Gmail Trigger Listener and connect Gmail credentials to listen for replies.
- Open Fetch Email Message and Create Draft Email and connect Gmail credentials for message retrieval and draft creation.
- Ensure Draft Response Agent receives the email content from Fetch Email Message and uses Parse Email Response as its output parser.
- For Retrieve Email History and Review Sent History (Gmail tools), add Gmail credentials to the parent node Draft Response Agent, not the tool sub-nodes.
- Credential Required: Connect your Gmail credentials to Gmail Trigger Listener, Fetch Email Message, and Create Draft Email.
Step 8: Configure Telegram Notifications
Telegram provides lead intake and confirmation alerts for newly inserted leads.
- Open Telegram User Trigger and connect Telegram credentials to enable inbound messages.
- Open Telegram Confirmation and ensure it is connected to Prepare Telegram Message → Cap Records E.
- Credential Required: Connect your Telegram credentials to Telegram User Trigger, Telegram File Download, and Telegram Confirmation.
Step 9: Test and Activate Your Workflow
Test each entry point to validate end-to-end behavior before enabling schedules in production.
- Use Execute Workflow with Scheduled Trigger A to confirm records flow through Supabase Fetch A → Sort Records C → Branch Check B → Route by Case → Iterate Batch A/B → Mailgun Dispatch nodes.
- Manually run Gmail Trigger Listener (or simulate input) and confirm it reaches Create Draft Email via Draft Response Agent.
- Trigger Telegram User Trigger with both voice and text to verify Detect Voice or Text routes correctly.
- Successful execution should show sent email actions in Mailgun nodes, updates in Supabase nodes, and draft creation in Gmail.
- Once verified, toggle each scheduled trigger to Active to run automatically.
Troubleshooting Tips
- Gmail credentials can expire or need specific permissions. If things break, check the connected Google account and OAuth scopes in n8n credentials first.
- If you’re using Wait nodes or external processing, timing varies. Bump up the wait duration if downstream steps fail because a prior update hasn’t landed yet.
- Mailgun sending can fail silently when domains aren’t verified or you hit account limits. Confirm your sending domain status and review Mailgun logs for bounces before changing the workflow.
Quick Answers
About 60 minutes if your Mailgun, Gmail, and database are ready.
No. You’ll mostly connect accounts and map your lead fields. The workflow includes code nodes, but you can usually leave them as-is.
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/Anthropic API usage, which is typically a few cents per drafted reply.
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.
Yes, and you should. Common tweaks include changing the prompts in the Draft Response Agent to match your voice, swapping the intent categories in the structured parser, and adjusting the Mailgun sequence logic so it reflects your steps (for example: intro, follow-up, breakup). You can also route “pricing” replies to a different label or Slack alert by editing the switch/if branches around classification.
Most of the time it’s an expired OAuth session or missing Gmail permissions. Reconnect the Gmail credential in n8n, then confirm the trigger is watching the right mailbox and label filters aren’t excluding messages. If it fails only on certain threads, check that the workflow can fetch the full email and history for that conversation.
On n8n Cloud Starter, expect a few thousand executions per month, which is enough for many small outbound programs.
It depends on how strict you are about control and scale. Zapier/Make can be fine for basic “new email → create draft” logic, but this workflow is doing more: batching, multi-branch routing, database lookups, thread history retrieval, structured AI outputs, and status updates that stop sequences. n8n handles that kind of branching without turning every path into a separate billable task. The self-host option is also a big deal if you run outreach daily. If you’re unsure, Talk to an automation expert and we’ll sanity-check your setup.
Once this is running, outbound feels calmer. Replies get handled, drafts show up where your team already works, and your lead statuses stop drifting out of sync.
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.