Google review ratings are a powerful lead qualification signal. Businesses with low ratings often need help with reputation management, customer service, or product quality. Businesses with high ratings and many reviews are strong partnership candidates. This tutorial shows how to use the Scavio API to search for local businesses, filter them by rating and review count, and build a qualified lead list. You will create a pipeline that targets businesses in specific rating ranges and exports them for outreach.
Prerequisites
- Python 3.8+ installed
- requests library installed
- A Scavio API key from scavio.dev
- A target industry and location
Walkthrough
Step 1: Search for businesses by category
Query Google Maps for businesses in your target category and location.
import os, requests, json
API_KEY = os.environ["SCAVIO_API_KEY"]
def search_businesses(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"})
return resp.json().get("local_results", [])
businesses = search_businesses("dentists", "San Francisco")
print(f"Found {len(businesses)} businesses")Step 2: Filter by rating range
Segment businesses into lead categories based on their review ratings.
def filter_by_rating(businesses, min_r, max_r, min_reviews=5):
return [
b for b in businesses
if min_r <= float(b.get("rating", 0)) <= max_r
and int(b.get("reviews", 0)) >= min_reviews
]
low_rated = filter_by_rating(businesses, 1.0, 3.5)
high_rated = filter_by_rating(businesses, 4.5, 5.0, min_reviews=50)
print(f"Low rated leads: {len(low_rated)}")
print(f"High rated prospects: {len(high_rated)}")Step 3: Enrich leads with additional data
Search for each lead's website to find contact information and context.
def enrich_lead(business):
name = business.get("title", "")
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": f"{name} contact"})
results = resp.json().get("organic_results", [])[:2]
return {
"name": name,
"rating": business.get("rating", ""),
"reviews": business.get("reviews", 0),
"address": business.get("address", ""),
"phone": business.get("phone", ""),
"website": results[0].get("link", "") if results else "",
}Step 4: Export qualified leads
Save the filtered and enriched leads to a JSON file for your CRM or outreach tool.
import csv
def export_leads(leads, filename):
enriched = [enrich_lead(b) for b in leads]
with open(filename, "w", newline="") as f:
w = csv.DictWriter(f, fieldnames=enriched[0].keys())
w.writeheader()
w.writerows(enriched)
print(f"Exported {len(enriched)} leads to {filename}")
export_leads(low_rated[:10], "low_rated_leads.csv")Python Example
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": "dentists in San Francisco", "type": "maps"})
for b in resp.json().get("local_results", []):
r = float(b.get("rating", 0))
if r <= 3.5 and int(b.get("reviews", 0)) >= 5:
print(f"{b['title']} - {r} stars ({b.get('reviews')} reviews)")JavaScript Example
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
const r = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST", headers: H,
body: JSON.stringify({platform: "google", query: "dentists in San Francisco", type: "maps"})
});
const data = await r.json();
(data.local_results || []).filter(b => parseFloat(b.rating||0) <= 3.5)
.forEach(b => console.log(b.title, b.rating, b.reviews));Expected Output
A qualified lead list of businesses filtered by Google review rating, enriched with contact data, and exported as CSV for outreach campaigns.