# Complete B2B sales pipeline: Apollo lead gen, Mailgun outreach: n8n workflow

> Started by an incoming Telegram message, and works across Apify, Gmail, Postgres, Supabase and one other.

Source: https://millionrounds.com/workflow/complete-b2b-sales-pipeline-apollo-lead-gen-mailgun-outreach (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Lead generation](https://millionrounds.com/workflows?category=Lead+generation#library)

# Complete B2B sales pipeline: Apollo lead gen, Mailgun outreach

Started by an incoming Telegram message, and works across Apify, Gmail, Postgres, Supabase and one other. It puts Claude and OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 96 steps, 8 branches, 12 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: Claude, OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcomplete-b2b-sales-pipeline-apollo-lead-gen-mailgun-outreach)

**96 steps** Large: read it before trusting it with anything live

**8** Branches: places the flow splits

**12** Loops or waits

**5** Services it connects to

## The flow

Starts it 6 Model 12 Logic 28 Service 14

The steps in the order they run, from what starts it. The first 60 of 96.

- 1 **Schedule Trigger1** Schedule trigger *Starts it*
- 2 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 3 **Structured Output Parser** Output Parser Structured *Model*
- 4 **Schedule Trigger3** Schedule trigger *Starts it*
- 5 **Schedule Trigger4** Schedule trigger *Starts it*
- 6 **Schedule Trigger6** Schedule trigger *Starts it*
- 7 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 8 **Simple Memory** Memory Buffer Window *Model*
- 9 **User message** Telegram trigger *Starts it*
- 10 **Structured Output Parser1** Output Parser Structured *Model*
- 11 **Gmail Trigger** Gmail trigger *Starts it*
- 12 **Get Email History** Gmail Tool *Service*
- 13 **Check Sent History** Gmail Tool *Service*
- 14 **Email Response Parser** Output Parser Structured *Model*
- 15 **Anthropic Chat Model1** Lm Chat Anthropic *Model*
- 16 **Supabase2** Supabase *Service*
- 17 **create email sequence** Agent *Model*
- 18 **Get many rows** Supabase *Service*
- 19 **Supabase11** Supabase *Service*
- 20 **Supabase13** Supabase *Service*
- 21 **Scraper agent** Agent *Model*
- 22 **Voice or Text1** Switch *Logic*
- 23 **extract email** Code *Logic*
- 24 **Professional Email Response Agent** Agent *Model*
- 25 **Sort2** Sort *Logic*
- 26 **Code** Code *Logic*
- 27 **If3** If *Logic*
- 28 **Evualute when the mail was sent** Code *Logic*
- 29 **Evualute when the mail was sent1** Code *Logic*
- 30 **Generate query payload** Set *Logic*
- 31 **Select already scraped mails** Postgres *Service*
- 32 **Download File1** Telegram *Service*
- 33 **Text1** Set *Logic*
- 34 **Execute a SQL query** Postgres *Service*
- 35 **Create Draft Response** Gmail *Service*
- 36 **If2** If *Logic*
- 37 **Merge** Merge *Logic*
- 38 **Sort1** Sort *Logic*
- 39 **No Operation, do nothing** No Op *Logic*
- 40 **If1** If *Logic*
- 41 **If** If *Logic*
- 42 **Create URL** Code *Logic*
- 43 **Keep only the new leads** Compare Datasets *Service*
- 44 **Transcribe1** Open Ai *Model*
- 45 **Only from email campaigns** Filter *Logic*
- 46 **Limit1** Limit *Logic*
- 47 **No Operation, do nothing2** No Op *Logic*
- 48 **Time Zone** Code *Logic*
- 49 **Limit** Limit *Logic*
- 50 **Sort** Sort *Logic*
- 51 **No Operation, do nothing1** No Op *Logic*
- 52 **Sort3** Sort *Logic*
- 53 **No Operation, do nothing4** No Op *Logic*
- 54 **Run an Actor** Apify *Service*
- 55 **Already scraped** No Op *Logic*
- 56 **Create rows with new leads** Supabase *Service*
- 57 **Set replied = Yes** Postgres *Service*
- 58 **Switch** Switch *Logic*
- 59 **Sender Email** Code *Logic*
- 60 **research about company** Open Ai *Model*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 96, with 8 branches, 12 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Apify, Gmail, Postgres, Supabase, Telegram
- **Model:** Claude, OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Apify, Gmail, Postgres, Supabase and Telegram accounts, and a key for Claude and OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

Yes. It calls Claude and OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 96 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 96 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcomplete-b2b-sales-pipeline-apollo-lead-gen-mailgun-outreach)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Apify](https://millionrounds.com/workflows?service=Apify#library)[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also lead generation, with the same services where possible, closest in size first.

- [**Qualify CSV leads, enrich emails, and deliver results** 93 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/qualify-csv-leads-enrich-emails-and-deliver-results)
- [**Automate personalized cold email sequences with Mailgun** 84 steps · calls a model · Apify, Postgres](https://millionrounds.com/workflow/automate-personalized-cold-email-sequences-with-mailgun)
- [**Local business leads and run AI-powered cold email sequences** 62 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/local-business-leads-and-run-ai-powered-cold-email-sequences)
- [**End-to-end B2B real estate lead enrichment & outreach** 58 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/end-to-end-b2b-real-estate-lead-enrichment-and-outreach)
- [**AI sales agent: fully email handling & lead scoring system** 57 steps · calls a model · Gmail, NocoDB](https://millionrounds.com/workflow/ai-sales-agent-fully-email-handling-and-lead-scoring-system)
- [**Smart email outreach sequence – AI-powered & customizable** 56 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/smart-email-outreach-sequence-ai-powered-and-customizable)
