🔓 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

Telegram to Postgres, verified Apollo leads saved clean

Lisa Granqvist Partner Workflow Automation Expert

Your lead list shouldn’t get worse every time you “move fast.” But when you’re pulling prospects from Apollo, copying them into sheets, cleaning emails, and trying not to re-upload duplicates, the mess is basically guaranteed.

Growth marketers feel it when campaigns stall because the list is dirty. Sales ops gets stuck fixing it. And founders doing their own outbound end up spending nights on what should’ve been a 2-minute task. This Telegram Apollo leads automation takes a voice note or text request and turns it into verified leads saved cleanly in Postgres.

Below you’ll see exactly how the workflow runs, what it automates, what results you can expect, and the common gotchas to avoid so it works on day one.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Telegram to Postgres, verified Apollo leads saved clean

The Problem: Lead lists get dirty the moment you scale

Manual lead scraping starts out “fine” until the volume increases. One person exports from Apollo, another person filters “verified” emails, someone else imports into a database, and suddenly you’ve got duplicates everywhere. Then the bounce rate spikes, domains warm slower, and outreach tools start flagging your campaigns. The worst part is the mental overhead. You stop trusting your own data, so every new campaign begins with cleanup instead of launching.

The friction compounds. Here’s where things usually break down.

  • Copy-pasting lead data between tools causes small mistakes that turn into bad personalization later.
  • Filtering for verified emails happens inconsistently, so deliverability takes a quiet hit over time.
  • Duplicates creep in when two teammates run similar searches a week apart.
  • “Quick list building” becomes a half-day job once you include exports, formatting, and imports.

The Solution: Telegram request → verified Apollo leads → Postgres

This workflow turns a simple Telegram message into a clean, deduped prospect table in your database. You send a text request like “Find 200 VP Marketing leads in Austin in SaaS” or just record a quick voice note. If it’s voice, the workflow retrieves the audio and transcribes it using OpenAI. Then an AI agent interprets what you meant (location, industry, job titles, company size) and converts that into structured search parameters. From there, it builds the Apollo search payload and runs a scrape via Apify, maps the returned lead fields, filters to verified emails only, and checks your existing Postgres/Supabase records to prevent duplicates. Finally, it inserts only the new leads and sends a Telegram confirmation with a count, so you know it worked.

The workflow starts in Telegram, so requests feel effortless. In the middle, AI turns messy human language into precise search criteria, then Apollo data is fetched, cleaned, and deduped. At the end, your Postgres table updates instantly and you get a “done” message back in Telegram.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you need 300 verified leads for a new outbound campaign. Manually, you might spend about 20 minutes building the Apollo filters, another 30 minutes exporting and cleaning, then 20 minutes deduping and importing into Postgres. Call it about 1.5 to 2 hours, plus the “did we already contact these?” anxiety. With this workflow, you send one Telegram request (maybe 30 seconds), wait under 30 seconds for processing, and you get a confirmation message once new leads are inserted. Your list is ready for outreach almost immediately.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Telegram for the voice/text request trigger
  • OpenAI to transcribe voice and interpret requests
  • Apollo.io + Apify to fetch lead data reliably
  • Postgres or Supabase to store leads and dedupe
  • API keys (from OpenAI, Apollo, Apify, and your DB)

Skill level: Intermediate. You’ll connect accounts, paste API keys, and confirm your database table fields match what you want to store.

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

How It Works

A Telegram message kicks it off. The workflow uses a Telegram trigger, then checks if you sent text or a voice note. Simple branch, no guesswork.

Voice gets transcribed, text gets captured. If it’s audio, n8n fetches the file and runs it through OpenAI transcription. If it’s already text, it’s saved as-is so the next step sees a consistent input.

An AI agent turns intent into targeting. The agent interprets your request and produces structured search criteria (titles, industries, locations, company size). That structure matters because it prevents “kinda close” searches that pull junk leads.

Apollo leads are fetched, cleaned, and deduped. The workflow assembles a search payload, runs an Apify actor to pull the results, maps key fields (name, title, company, LinkedIn, email), filters to verified emails, and compares against existing records from Postgres/Supabase so repeats don’t get inserted.

You get an instant confirmation. After inserting only new leads, n8n sends a Telegram message back with the count and (optionally) a link to the generated Apollo search.

You can easily modify the search limits and the stored fields based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Telegram Trigger

Set up the workflow to start when a Telegram message arrives so the pipeline can accept voice or text lead requests.

  1. Add Telegram Message Trigger and keep Updates set to message.
  2. Credential Required: Connect your telegramApi credentials in Telegram Message Trigger.
  3. Open your Telegram bot and send a test message to confirm the trigger is reachable.

Step 2: Route Voice vs. Text Inputs

This step branches the flow based on whether the user sent a voice note or text.

  1. In Detect Voice Or Text, keep the two rules that check {{ $json.message.voice.file_id }} and {{ $json.message.text }} to create Voice and Text outputs.
  2. For the voice branch, configure Retrieve Voice File with Resource set to file and File ID set to {{ $json.message.voice.file_id }}.
  3. Credential Required: Connect your telegramApi credentials in Retrieve Voice File.
  4. For the text branch, configure Capture Text Input to set text to {{ $json.message.text }}.
  5. Connect Retrieve Voice FileTranscribe Audio and Capture Text InputLead Scraper Agent.

Step 3: Set Up AI Processing for Query Extraction

This step turns voice or text into a structured query that the scraper can use.

  1. In Transcribe Audio, keep Resource set to audio and Operation set to transcribe.
  2. Credential Required: Connect your openAiApi credentials in Transcribe Audio.
  3. Configure Lead Scraper Agent with Text set to {{ $json.text }} and ensure Prompt Type is define with Has Output Parser enabled.
  4. In OpenAI Chat Engine, set the Model to gpt-4.1-nano (or your preferred model).
  5. Credential Required: Connect your openAiApi credentials in OpenAI Chat Engine.
  6. Attach Buffer Memory and Structured Parser to Lead Scraper Agent as AI sub-nodes. Ensure credentials are added to OpenAI Chat Engine (parent), not to the sub-nodes.
  7. Confirm Structured Parser uses the provided JSON schema example for location, business, and job_title.

Lead Scraper Agent outputs to both Build Query Payload and Fetch Existing Emails in parallel.

Step 4: Build and Execute the Lead Scrape

Generate a search URL, run the Apify actor, and map the lead results into a consistent structure.

  1. In Build Query Payload, set Mode to raw and JSON Output to { "query": {{ $json.output }} }.
  2. In Assemble Search Link, keep the provided JavaScript to build the Apollo URL and output finalURL.
  3. In Execute Apify Actor, set Operation to Run actor, Build to latest, Timeout to 10000, and Wait For Finish to 60.
  4. Set Custom Body in Execute Apify Actor to { "getPersonalEmails": true, "getWorkEmails": true, "totalRecords": 500, "url": "{{ $json.finalURL }}" }.
  5. Credential Required: Connect your apifyApi credentials in Execute Apify Actor.
  6. In Map Lead Details, map fields like firstName to {{ $json.first_name }}, emailAddress to {{ $json.email }}, and jobTitle to {{ $json.employment_history[0].title }}.

⚠️ Common Pitfall: If the scraper returns empty employment_history, the expression {{ $json.employment_history[0].title }} will fail. Consider adding guard logic if needed.

Step 5: Filter and Deduplicate Leads

Only verified emails are saved, and existing emails are removed before insertion.

  1. In Filter Verified Emails, keep the condition emailStatus equals verified using {{ $json.emailStatus }}.
  2. In Fetch Existing Emails, set Operation to select, Return All to true, and include outputColumns of emailAddress.
  3. Credential Required: Connect your postgres credentials in Fetch Existing Emails.
  4. In Isolate New Leads, keep Merge By Fields configured to compare incoming emails with existing ones.
  5. Leave Marked Existing as a no-op branch for duplicates.

Step 6: Store Results and Send Telegram Confirmation

New leads are inserted into Supabase, a confirmation message is composed, and a Telegram reply is sent.

  1. In Insert New Leads, set Table ID to Leads_n-mail and map fields like firstName to {{ $json.firstName }}, jobTitle to {{ $json.jobTitle }}, and country to {{ $json.country }}.
  2. Review the businessIndustry mapping: {{ $json.businessIndustry }}{{ $('Apollo Scraper').item.json.organization.industry }}.
  3. Credential Required: Connect your supabase credentials in Insert New Leads (no credentials are configured yet).
  4. In Compose Telegram Reply, set output to {{ $input.all().length }} new contacts have been added to the Google Sheet!.
  5. In Send Telegram Confirmation, set Text to {{ $input.all().length }} new contacts have been added to the Google Sheet! and Chat ID to [YOUR_ID].
  6. Credential Required: Connect your telegramApi credentials in Send Telegram Confirmation.

⚠️ Common Pitfall: The workflow references Apollo Scraper in Insert New Leads, but that node does not exist in this workflow. Replace that reference or remove it to prevent execution errors.

Step 7: Review Placeholder and Non-Functional Nodes

This workflow includes non-executing nodes that are used for annotation or future expansion.

  1. Keep Flowpast Branding as a documentation note in the canvas.
  2. Identify Unnamed (type unknown) and remove or replace it if it appears in any future connections.

If you plan to extend the workflow, use Unnamed or Marked Existing as placeholder stubs before adding real actions.

Step 8: Test and Activate Your Workflow

Validate the workflow end-to-end and then enable it for production use.

  1. Click Execute Workflow and send a text or voice message to your Telegram bot.
  2. Confirm that Detect Voice Or Text routes correctly and that Lead Scraper Agent outputs a structured query.
  3. Verify Execute Apify Actor returns lead data and that Insert New Leads creates records in Leads_n-mail.
  4. Check that Send Telegram Confirmation delivers a message with the correct count.
  5. When successful, toggle the workflow to Active to run automatically on new Telegram messages.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Telegram file access can fail if your bot token changes or lacks permission. If audio retrieval breaks, check the Telegram credentials in n8n first, then verify the chat is still authorized.
  • If you’re using Wait nodes or external rendering, 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 Telegram Apollo leads automation?

About 45 minutes if your API keys and database are ready.

Do I need coding skills to automate Telegram Apollo leads?

No. You’ll mostly connect accounts and paste API keys. The only “technical” part is confirming your Postgres/Supabase table columns match the mapped fields.

Is n8n free to use for this Telegram Apollo leads 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 transcription/chat usage plus Apollo/Apify costs, which depend on how many leads you pull.

Where can I host n8n to run this Telegram Apollo leads 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 Telegram Apollo leads workflow for different industries and job titles?

Yes, and it’s the point of the build. You can adjust the AI Agent’s instructions so it recognizes your preferred job title patterns, seniority rules, and location formats, then update the “Build Query Payload” mapping so Apollo gets exactly those filters. Common tweaks include restricting to specific seniority levels, adding exclusions (like “recruiter”), and changing the per-request lead cap so you don’t over-pull.

Why is my Telegram connection failing in this workflow?

Usually it’s the bot token or chat authorization. Re-check the Telegram credentials in n8n, then confirm the bot is still in the chat and allowed to read messages. If only voice requests fail, the “Retrieve Voice File” step is the clue: Telegram may be returning a file_id your bot can’t fetch until permissions are corrected. Also worth checking basic rate limits if you’re blasting requests back-to-back.

How many leads can this Telegram Apollo leads automation handle?

The workflow is designed to process 500+ leads per request, and the practical limit is usually your Apollo/Apify plan plus how big you set the batch and limit nodes. On n8n Cloud Starter, execution limits depend on your plan tier; on self-hosted n8n there’s no execution cap, but your server resources still matter. If you’re pulling big lists, run smaller batches more often, because that keeps the database insert fast and the dedupe check reliable.

Is this Telegram Apollo leads automation better than using Zapier or Make?

Often, yes. This workflow leans on branching logic (voice vs text), structured AI parsing, batching, and dedupe checks against a database, which is where Zapier and Make can get clunky or expensive. n8n also gives you the option to self-host, which is a big deal if you run lead-gen at scale. That said, if you only need “Apollo export → Google Sheet” and nothing else, simpler tools can be fine. If you want help choosing, Talk to an automation expert.

This is the kind of automation that quietly fixes your outbound system. Cleaner leads go in, fewer problems come out.

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