Duck
Tutorials6 min read

Building an AI-Powered Lead Generation Pipeline

Samet Turan— Editor··6 min read

Learn how to scrape LinkedIn, enrich contacts with AI, and automate exports using cheap tools—then get a ready-made blueprint to skip the build.

Building an AI-Powered Lead Generation Pipeline

Last month I needed to pull 500 LinkedIn profiles for a niche SaaS product and found that manual copy‑pasting ate up two full days. After trying a few AI‑powered scraper tutorials that promised “push‑button” results, I ended up with junk data and a frustrated inbox. By the end of this guide you’ll have a working pipeline that scrapes, enriches, and exports leads using only a few cheap tools and a handful of prompts.

Last month I needed to scrape 500 LinkedIn profiles for a niche SaaS product

I run a tiny outreach agency and a client asked for a list of founders who use a specific CRM. The list had to be fresh, with verified emails and LinkedIn URLs. Doing it by hand meant opening each profile, copying the name, title, company, and then hunting for an email via Hunter.io. After three hours I had 30 leads and a sore wrist.

I turned to a popular AI‑powered scraper guide that said: “Just give the AI a URL and let it extract everything.” The guide used a free trial of a cloud scraping platform and a GPT‑4 prompt. I followed the steps, ran the job, and got back a CSV full of nonsense—phone numbers in the name field, random blog snippets as titles, and zero emails.

The frustration taught me two things: first, most “AI‑powered” tutorials skip the data‑validation step; second, you need a deterministic wrapper around the AI to keep the output usable.

What most guides get wrong about AI-powered scrapers

Many guides treat the language model as a magic black box that can understand any web page. They show a prompt like “Extract the person’s name, title, company, and email from this LinkedIn profile” and call it a day. In reality, the model hallucinates when the page layout changes, when there are pop‑ups, or when the text is embedded in JavaScript.

What they omit is the need for a pre‑scrape step that pulls the raw HTML with a traditional scraper, then feeds only the cleaned text to the AI. Without that separation you get garbage‑in, garbage‑out.

Another common mistake is ignoring rate limits. LinkedIn blocks aggressive requests after a few dozen pages. Guides that promise “run 10 000 profiles overnight” get you banned before you see results.

How do I debug when the AI agent returns junk?

Start by checking the raw input. Save the HTML snippet that you sent to the model and open it in a browser. Does the text you expect actually appear in the source? If not, your scraper is pulling the wrong element.

Next, look at the prompt. Are you asking for fields that are not present on the page? For LinkedIn, the email is never visible; you must enrich later with a separate service. Asking the AI to invent an email will always produce hallucinations.

Finally, run a small batch with logging. Print the model’s raw response before you parse it. If you see repetitive phrases like “As an AI language model…” you know the prompt is too vague or the model is falling back to its default behavior.

Why does my AI agent keep hallucinating contact info?

Hallucinations happen when the model tries to fill gaps with plausible‑sounding data. In lead gen, the gap is usually the email address, which LinkedIn deliberately hides. The model, trained on vast text, has seen many email patterns and will generate one that looks real but is completely fabricated.

The fix is simple: never ask the model to produce an email from a LinkedIn page. Instead, scrape the profile URL, then pass it to an email‑finder API like Hunter.io or UseArtemis. Keep the AI’s job limited to extracting name, title, and company—fields that are actually visible.

Putting it together: prompts, tools, and a cheap stack

Here’s the exact flow I use every week:

  • Use Apify’s LinkedIn Search Actor to pull profile URLs based on a keyword and location filter. Set the limit to 100 per run to stay under LinkedIn’s throttling.
  • Feed those URLs into a second Apify actor that downloads the raw HTML and strips scripts, leaving only plain text.
  • Send the cleaned text to GPT-4o with this prompt: “Extract the person’s full name, current job title, and company name. Return JSON with keys name, title, company. If a field is missing, return null.”
  • Parse the JSON, then call Hunter.io’s API to lookup an email using the domain from the company field and the person’s name.
  • Collect the final record (name, title, company, LinkedIn URL, email) and append it to a Google Sheet via Make (formerly Integromat)’s HTTP module.
  • Schedule the whole scenario in Make.com to run every night at 02:00 AM.

Below is the exact prompt I paste into the GPT-4o module (you can copy‑paste it):

Extract the person’s full name, current job title, and company name. Return JSON with keys name, title, company. If a field is missing, return null.

Make.com handles the orchestration: it calls Apify, waits for the finished dataset, loops over each URL, runs the HTML‑stripper, then the GPT-4o step, then the Hunter.io lookup, and finally writes to Sheets. The whole thing costs me about $0.02 per lead.

Price check and my honest take

Apify’s free tier gives you 10 000 compute‑seconds per month, enough for roughly 500 profile scrapes. I stay on the free plan because my volume is low; the paid $49/mo plan feels overpriced for my use‑case.

Make.com’s core plan is $29/mo and provides 10 000 operations, which covers my nightly run plus a few test scenarios. I think that’s fair for the automation minutes you get.

Hunter.io charges $49/mo for 500 lookups, but I only need about 100 lookups a month, so I stick with the pay‑as‑you‑go option at $0.01 per lookup.

If you add it all up, the variable cost per lead is under $0.03, and the fixed monthly spend stays below $60. For a solo operator that’s a steal compared to hiring a VA.

One concrete gripe: the Apify actor runtime docs assume you know Docker, which cost me three hours of trial and error before I realized I could just use the built‑in scraper template.

One concrete love: I love how Make.com’s visual scheduler lets me set the scraper to run at 2 a.m. with a single click—no cron syntax, no server to manage.

— and good luck finding docs for this — the Make.com forum is surprisingly quiet, but the support team replies within a day when you email them.

We cover this in more depth elsewhere — deeper coverage of AI agent platforms.

If you’d rather skip the build and deploy a working version in an afternoon, we’ve packaged this workflow as a blueprint at deepusecase.com/vault.

— The Colophon

One AI tool. Tested. Reviewed.
In your inbox every Sunday.

~3 minute read. Real outcomes from operators, not marketers.

Free. One email per Sunday. Unsubscribe in one click.