Blog · Jawad Chafai

How I built an AI prospecting pipeline that qualifies B2B leads on its own

By Jawad Chafai, RevOps and GTM engineer ·

Reps were spending their week researching instead of calling. Here's how I combined Apollo.io, Perplexity and Python into a pipeline that finds decision-makers, scores each company on eight buying signals, and writes a brief for every qualified lead.

The team I work with in Morocco sells corporate training (AI, data and leadership programs) to mid-size and large companies. For a long time, finding the next client looked like this: a rep searches LinkedIn or Apollo, reads through the results, guesses which companies are worth a call, then writes an opening from a blank page. Before every single call.

It didn't scale, and it wasn't consistent. Two reps qualifying the same list would land on different answers, because "is this company worth pursuing?" was a fresh judgment call every time, not a shared standard.

So I built a pipeline that does the research for them. This is how it works, what I learned, and why I think every small sales team can build something like it.

Why relevance matters more than ever

Two trends make this kind of tool worth building now.

First, buyers don't want to be sold to. Gartner's latest survey found that 67% of B2B buyers prefer a rep-free buying experience, up from 61% a year earlier. When buyers do their own research first, a generic cold email gets ignored. The rep who shows up with a specific, relevant reason to talk is the one who gets the meeting.

61% of B2B buyers preferred a rep-free experience in Gartner's 2025 survey, 67% in 2026
61% of B2B buyers preferred a rep-free experience in Gartner's 2025 survey, 67% in 2026

Second, AI has moved from experiment to standard practice in sales. Salesforce's State of Sales research found 81% of sales teams are experimenting with or have fully implemented AI, and 83% of teams with AI grew revenue, compared with 66% of teams without it.

41% of sales teams have fully implemented AI and 40% are experimenting; 83% of teams with AI grew revenue vs 66% without
41% of sales teams have fully implemented AI and 40% are experimenting; 83% of teams with AI grew revenue vs 66% without

That second number is a correlation, not proof that AI causes growth. But it matches what I've seen: the value isn't in AI writing more emails. It's in AI doing the research that makes each email worth sending.

The pipeline at a glance

It takes a list of countries, industries and company sizes, and turns it into a ranked, ready-to-call spreadsheet in two AI passes: one to qualify the company, one to brief the person.

The pipeline: find people in Apollo.io, score each company on 8 buying signals with Perplexity, write a brief, deliver a colour-coded call list
The pipeline: find people in Apollo.io, score each company on 8 buying signals with Perplexity, write a brief, deliver a colour-coded call list

Step 1: Find the people, then the companies

The obvious starting point was Apollo's company search. It wasn't available on our plan. Instead of paying for an upgrade, I flipped the order: the pipeline searches Apollo for people first (HR directors, heads of L&D, COOs, CTOs at companies matching our filters), then reads each person's employer details from the same result. Same data, no plan upgrade.

The team runs it from a simple web form built with Streamlit, so nobody needs to touch Python or a terminal. Pick industries, location and company size, choose how many qualified companies you want, and press run.

The pipeline's web form: industries, location, company size and advanced filters
The pipeline's web form: industries, location, company size and advanced filters

Step 2: Score every company on eight buying signals

This is the part that matters most, and it wasn't code. Before writing the qualification prompt, I worked out who we actually sell to, using the company's own persona research. Every deal involves two different people: the budget holder (short on time, skeptical of generic training, needs to see return fast) and the internal champion, who often isn't the one who can say yes.

Then, instead of qualifying on "right industry, right headcount" (easy, but shallow), I wrote eight evidence-based buying signals into the prompt: things like visible skills gaps, AI adoption happening without governance, and leadership readiness gaps. Perplexity researches each company on the live web and marks it Go, Review or No-Go, with a one-line reason.

A company only gets a Go because something is actually happening there, not because it looked good on paper. And Review exists on purpose: when the evidence is mixed, a human decides.

Live log while the pipeline runs: sourcing, qualification, then contact enrichment and briefing
Live log while the pipeline runs: sourcing, qualification, then contact enrichment and briefing

Step 3: Brief every Go before the first call

For every company marked Go, a second Perplexity pass researches the contact, their company and their industry context, then writes a short brief: why this person, what they likely care about, and a tailored opening angle grounded in the company's real client outcomes.

The output is one colour-coded workbook. Green means Go, yellow means Review, red means No-Go. A rep opens it and starts calling.

The company qualification sheet: AI verdict, the reasoning behind it, and which roles to target
The company qualification sheet: AI verdict, the reasoning behind it, and which roles to target
Enriched contacts and briefs for every Go lead (personal details blurred)
Enriched contacts and briefs for every Go lead (personal details blurred)

What I'd tell anyone building one

Write the business rules before the prompt. The quality of the pipeline came from the eight signals, and those came from persona research, not from prompt tricks. An AI prompt is a business rule. Treat it like one: write it down, review it with the sales team, and version it.

Design for the person who will run it. A script only the builder can run is a dependency on the builder. Wrapping it in a form meant the team could use it without me.

Save as you go. An early run was killed halfway through by a dropped connection, and every completed record was lost, along with the API credits already spent. Now every company and contact is written to the output file the moment it's processed. A crash costs minutes, not money.

Keep a human in the loop. The Review status isn't a failure of the model. It's where judgment belongs.

Work around limits before paying to remove them. The people-first search was a workaround for a plan limit, and it turned out to be the better design anyway: we wanted the person, not just the company.

A completed run: companies sourced, marked Go, contacts found, and a workbook ready to download
A completed run: companies sourced, marked Go, contacts found, and a workbook ready to download

The result

One consistent standard for "is this worth a call", instead of a fresh judgment every time. Every Go lead arrives with an opening angle already written. Teammates who don't code can run it themselves. And a crashed run no longer means lost work.

The full case study, with more on the architecture, is on my portfolio.