n8n workflow · Chapter 1 of 5

Agency Lead Hunter

Updated · Tested on n8n 1.x · Part of the n8n Marketing Agency ebook

Message your Telegram bot "50 real estate businesses in Pune" and your Leads sheet fills with real businesses, contact details and an AI fit score.

Agency Lead Hunter n8n workflow screenshot — n8n Marketing Agency ebook
Real screenshot of the Agency Lead Hunter workflow running in n8n, from the n8n Marketing Agency ebook.

How this n8n workflow works

  1. 1You send a request to the Telegram bot
  2. 2AI turns it into search details
  3. 3Apify scrapes matching businesses from Google Maps
  4. 4Duplicates are removed
  5. 5AI scores each lead; good ones are saved

Who this workflow is for

  • Marketing / video / web agencies — fill your pipeline with local businesses that fit your offer.
  • Freelancers & consultants — find prospects in any niche + city on demand, no VA needed.
  • SDR / outbound teams — generate a clean, deduped, pre-scored lead list before writing a single email.

Why it matters: Prospecting is the grind every agency hates — hours of Googling, copying emails, guessing who's worth contacting. This bot compresses that into one Telegram message: it finds real businesses with real emails, removes anyone you've already got, and ranks them so you contact the best-fit prospects first. You spend your time closing, not hunting. (In this series, Chapter 2 then emails these leads, and Chapter 3 follows up — a full grow-your-agency autopilot.)

Inside the workflow: node by node

Every one of these nodes is explained in the ebook, with each setting, prompt and expression printed so you can copy it.

  1. 1. Telegram Command In — Your Trigger
  2. 2. Parse Lead Command — Understand the Request
  3. 3. Normalize Command — Clean the Parameters
  4. 4. Call Apify Google Maps — Scrape the Businesses
  5. 5. Read Existing Maps Emails — Load What You Already Have
  6. 6. Process Maps Results — Clean + Dedupe
  7. 7. Loop Maps Leads — One Lead at a Time
  8. 8. Score Maps Lead — Rate Each Prospect
  9. 9. Attach Maps Score — Merge Score + Lead
  10. 10. Keep Maps Score — Filter the Good Ones
  11. 11. Prepare Maps Sheet Row — Build the Row
  12. 12. Save Maps Lead — Write to the Sheet
  13. 13. Build Maps Confirm — Count the Fresh Leads
  14. 14. Send Maps Confirm — Telegram You the Count

Before you start

  • An n8n account (Cloud or self-hosted).
  • A Telegram bot + your chat ID — how you send commands and get confirmations.
  • An Apify account + API token — runs the Google Maps scraper (free credits to start).
  • An OpenAI (or OpenRouter) API key — powers the command parser + lead scorer (gpt-4o-mini).
  • A Google Sheets credential — your Leads sheet (this demo uses a tab named RevisionWave LinkedIn Leads; rename it to your agency's).

Quick setup guide

  1. 1Credentials: Add Telegram, Apify (API token), OpenAI/OpenRouter, and Google Sheets (see the video table).
  2. 2Prepare the sheet: Create a Leads tab with columns like Date, Name, Company, Website, Email, Phone, City, Country, Category, ServiceOffer, Score, ScoreReason, OutreachAngle, Temperature, Stage, Source, Status. Copy the Sheet ID.
  3. 3Import the workflow: . Reconnect every credential. Put your Sheet ID on both Google Sheets nodes, your chat ID on the three Telegram nodes, and your Apify token into the Call Apify node's URL.
  4. 4Tune it: The keep-threshold (score ≥ 6), the Hot cutoff (≥ 8), and the over-fetch multiplier (× 4, cap 40) are all editable to taste.
  5. 5Test: Message the bot "20 dentists in Pune needing marketing" → watch leads appear in the sheet and get the Telegram confirmation. Then Activate.

What success looks like: One Telegram line → a clean, deduped, AI-scored lead list in your CRM, ready for Chapter 2 to email.

Common problems and fixes

"Apify run failed" alert

Why: Wrong/expired Apify token, or out of credits

Fix: Replace the token in the Call Apify URL; check your Apify plan

No leads saved

Why: Businesses had no emails, or all were duplicates

Fix: Try a bigger count or a different city/category; check the sheet's existing emails

Same leads appear again

Why: Dedupe can't read existing emails

Fix: Ensure Read Existing Emails points at the same sheet/tab and has an Email column

Parser returns blank city

Why: Command was ambiguous

Fix: Include the city clearly ("in Pune"); the AI never invents a city

Everything scored low / dropped

Why: Service offer mismatch or vague command

Fix: State the service ("needing SEO"); lower the keep-threshold if needed

Bot ignores me

Why: Chat ID not whitelisted

Fix: Set Restrict to Chat IDs to your chat ID

Phone shows as a formula error

Why: Leading + in phone

Fix: The textSafe() helper already prefixes an apostrophe — keep that code

Setup time

  • With Claude Code30–45 minutes

    Give the ebook to Claude Code and it builds the workflow for you.

  • Import the JSON yourselfAbout 2 hours

    Import the ready workflow JSON and connect your accounts.

  • Build it by reading the ebookAbout 1 day

    Follow every node and setting step by step to learn it fully.

Get this workflow

  • Ready-to-import n8n workflow JSON
  • Step-by-step PDF: every node and setting explained
  • Copy-paste prompts and expressions — no coding

Frequently asked questions

Will this work on free n8n?

Yes. n8n itself can be free (the self-hosted Community edition) or you can use n8n Cloud. The workflow runs on both. You only pay for the outside services it uses, such as AI tokens, and many of them have free tiers to start.

How do I get the API keys (WhatsApp, OpenAI and others)?

The ebook includes a setup video for every API and account this workflow needs, so you can get each key step by step without any coding.

Do I need to know coding?

No. Every node, setting, prompt and expression is printed in the ebook, ready to copy-paste, and the workflow JSON can be imported in one click.

Can I use this Marketing Agencies workflow for my clients?

Yes. Once it works for you, you can set it up for your own business or for clients and charge for the setup.

"Apify run failed" alert: how do I fix it?

Wrong/expired Apify token, or out of credits. Fix: Replace the token in the Call Apify URL; check your Apify plan.

No leads saved: how do I fix it?

Businesses had no emails, or all were duplicates. Fix: Try a bigger count or a different city/category; check the sheet's existing emails.

Same leads appear again: how do I fix it?

Dedupe can't read existing emails. Fix: Ensure Read Existing Emails points at the same sheet/tab and has an Email column.

More workflows in “Marketing Agencies”