Tutorial

How to Build a Google Maps Lead Pipeline

Extract and enrich Google Maps business leads automatically. Build a pipeline that finds, scores, and exports local business contacts.

Google Maps is the largest directory of local businesses, making it a primary source for B2B lead generation. A lead pipeline that extracts Maps data, enriches it with website and review information, and scores leads by quality produces a steady flow of qualified prospects. This tutorial shows how to build an automated Google Maps lead pipeline using the Scavio API. You will query local businesses by category and location, enrich each lead with additional search data, and export scored leads ready for outreach.

Prerequisites

  • Python 3.8+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • Target business categories and locations

Walkthrough

Step 1: Query Google Maps for businesses

Search for businesses by category and location to build the initial lead list.

Python
import os, requests, json

API_KEY = os.environ["SCAVIO_API_KEY"]

def find_businesses(category, location):
    query = f"{category} in {location}"
    resp = requests.post("https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": "google", "query": query, "type": "maps"})
    return resp.json().get("local_results", [])

Step 2: Enrich leads with website data

Search for each business to find additional context like website, social profiles, and recent mentions.

Python
def enrich_lead(business_name, location):
    resp = requests.post("https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": "google", "query": f"{business_name} {location}"})
    results = resp.json().get("organic_results", [])[:3]
    websites = [r.get("link","") for r in results if business_name.lower() in r.get("title","").lower()]
    return {"website": websites[0] if websites else None,
            "mentions": len(results)}

Step 3: Score and rank leads

Apply a scoring formula based on rating, reviews, and web presence.

Python
def score_lead(business, enrichment):
    rating = float(business.get("rating", 0))
    reviews = int(business.get("reviews", 0))
    has_website = 1 if enrichment.get("website") else 0
    score = (rating / 5.0) * 40 + min(reviews / 50, 1.0) * 30 + has_website * 30
    return round(score, 1)

Step 4: Build and export the pipeline

Run the full pipeline for a category and export scored leads.

Python
def lead_pipeline(category, location, min_score=40):
    businesses = find_businesses(category, location)
    leads = []
    for b in businesses:
        enrichment = enrich_lead(b.get("title",""), location)
        s = score_lead(b, enrichment)
        if s >= min_score:
            leads.append({
                "name": b.get("title",""), "phone": b.get("phone",""),
                "address": b.get("address",""), "rating": b.get("rating",""),
                "reviews": b.get("reviews",0), "website": enrichment.get("website",""),
                "score": s,
            })
    leads.sort(key=lambda x: x["score"], reverse=True)
    with open("leads_pipeline.json", "w") as f:
        json.dump(leads, f, indent=2)
    print(f"Exported {len(leads)} leads")
    return leads

lead_pipeline("dentists", "Los Angeles CA")

Python Example

Python
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
def leads(category, location):
    resp = requests.post("https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": "google", "query": f"{category} in {location}", "type": "maps"})
    for b in resp.json().get("local_results", [])[:5]:
        print(f"{b['title']} | {b.get('rating','N/A')} | {b.get('phone','N/A')}")

leads("dentists", "Los Angeles CA")

JavaScript Example

JavaScript
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
async function leads(category, location) {
  const r = await fetch("https://api.scavio.dev/api/v1/search", {
    method: "POST", headers: H,
    body: JSON.stringify({platform: "google", query: category+" in "+location, type: "maps"})
  });
  const results = (await r.json()).local_results || [];
  results.slice(0,5).forEach(b =>
    console.log(b.title, b.rating, b.phone)
  );
}
leads("dentists", "Los Angeles CA");

Expected Output

JSON
An automated lead pipeline that extracts Google Maps businesses, enriches with website data, scores by quality, and exports ranked leads for outreach.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+ installed. requests library installed. A Scavio API key from scavio.dev. Target business categories and locations. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Extract and enrich Google Maps business leads automatically. Build a pipeline that finds, scores, and exports local business contacts.