# AI-powered lead generation with Apollo and OpenAI: n8n workflow

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

Source: https://millionrounds.com/workflow/ai-powered-lead-generation-with-apollo-and-openai (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)

# AI-powered lead generation with Apollo and OpenAI

Started by an incoming Telegram message, and works across Apify, Postgres, Supabase and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 21 steps, 1 branch: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fai-powered-lead-generation-with-apollo-and-openai)

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

**1** Branch: places the flow splits

**0** Loops or waits

**4** Services it connects to

## The flow

Starts it 1 Model 5 Logic 9 Service 6

The steps in the order they run, from what starts it.

- 1 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 2 **Simple Memory** Memory Buffer Window *Model*
- 3 **Structured Output Parser** Output Parser Structured *Model*
- 4 **User message** Telegram trigger *Starts it*
- 5 **Scraper agent** Agent *Model*
- 6 **Voice or Text1** Switch *Logic*
- 7 **Generate query payload** Set *Logic*
- 8 **Select already scraped mails** Postgres *Service*
- 9 **Download File1** Telegram *Service*
- 10 **Text1** Set *Logic*
- 11 **Create URL** Code *Logic*
- 12 **Keep only the new leads** Compare Datasets *Service*
- 13 **Transcribe1** Open Ai *Model*
- 14 **Run an Actor** Apify *Service*
- 15 **Already scraped** No Op *Logic*
- 16 **Create rows with new leads** Supabase *Service*
- 17 **Extract Info** Set *Logic*
- 18 **Set Telegram message** Set *Logic*
- 19 **Only Keep Verified Emails** Filter *Logic*
- 20 **Limit** Limit *Logic*
- 21 **Confirmation message** Telegram *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 21, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Apify, Postgres, Supabase, Telegram
- **Model:** 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, Postgres, Supabase and Telegram accounts, and a key for 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 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 21 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 21 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%2Fai-powered-lead-generation-with-apollo-and-openai)
- **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)[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.

- [**Generate personalized cold email openers with Claude** 21 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/generate-personalized-cold-email-openers-with-claude)
- [**Scrape Google Maps leads with OpenAI and Telegram** 21 steps · calls a model · Notion, Telegram](https://millionrounds.com/workflow/scrape-google-maps-leads-with-openai-and-telegram)
- [**Automate event follow-ups with OpenAI and LinkedIn** 20 steps · calls a model · Email, HubSpot](https://millionrounds.com/workflow/automate-event-follow-ups-with-openai-and-linkedin)
- [**Automated local business lead generator with WhatsApp** 22 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/automated-local-business-lead-generator-with-whatsapp)
- [**Capture, score and route Gmail leads with Groq Llama 3.3** 22 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/capture-score-and-route-gmail-leads-with-groq-llama-3-3)
- [**Local Business Lead Discovery and Enrichment Agent with OpenAI** 20 steps · calls a model · Gmail, Postgres](https://millionrounds.com/workflow/local-business-lead-discovery-and-enrichment-agent-with-open)
