Les agences de marketing digital ont besoin d'un flux constant de leads qualifiés : des entreprises locales qui ont besoin de sites web, de SEO ou de services de marketing digital. La prospection manuelle sur Google Maps prend 4 à 6 heures par session pour 30 à 40 leads. Ce tutoriel automatise le pipeline : rechercher des entreprises dans des niches et villes cibles, évaluer leur présence en ligne, les noter selon l'opportunité, et exporter les leads qualifiés pour la prospection.
Prérequis
- Python 3.8+ installé
- bibliothèque requests installée
- Une clé API Scavio depuis scavio.dev
- Une liste de niches et villes cibles
Parcours
Étape 1: Définissez vos niches et villes cibles
Configurez la matrice de recherche : quels types d'entreprises dans quels lieux.
NICHES = ['plumber', 'electrician', 'dentist', 'restaurant', 'auto repair']
CITIES = ['Austin TX', 'Denver CO', 'Portland OR', 'Nashville TN']
API_KEY = os.environ['SCAVIO_API_KEY']Étape 2: Recherchez des entreprises
Interrogez Google pour chaque combinaison niche-ville afin de trouver des entreprises locales.
import requests, os
H = {'x-api-key': API_KEY}
def find_businesses(niche: str, city: str) -> list:
resp = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'google', 'query': f'{niche} {city}'}, timeout=10)
return [{'name': r['title'], 'url': r.get('link', ''), 'snippet': r.get('snippet', '')}
for r in resp.json().get('organic', [])[:10]]Étape 3: Notez chaque lead selon l'opportunité
Évaluez la présence en ligne du lead pour estimer à quel point ils ont besoin de vos services.
def score_lead(lead: dict) -> dict:
url = lead.get('url', '')
score = 5 # baseline
# No website or directory listing only
if 'yelp.com' in url or 'yellowpages' in url:
score += 3 # high opportunity, no owned website
# Check for reviews mention in snippet
snippet = lead.get('snippet', '').lower()
if 'no reviews' in snippet or 'be the first' in snippet:
score += 2 # low online presence
lead['opportunity_score'] = min(score, 10)
return lead
# Score all leads
scored = [score_lead(l) for l in leads]Étape 4: Exécutez le pipeline complet et exportez
Parcourez toutes les combinaisons niche-ville, notez les leads et exportez les meilleurs.
import csv, time
def run_pipeline() -> list:
all_leads = []
for niche in NICHES:
for city in CITIES:
businesses = find_businesses(niche, city)
for b in businesses:
b['niche'] = niche
b['city'] = city
score_lead(b)
all_leads.append(b)
time.sleep(0.5)
all_leads.sort(key=lambda x: x['opportunity_score'], reverse=True)
with open('qualified_leads.csv', 'w', newline='') as f:
w = csv.DictWriter(f, fieldnames=['name', 'niche', 'city', 'url', 'opportunity_score'])
w.writeheader()
w.writerows([{k: l[k] for k in ['name', 'niche', 'city', 'url', 'opportunity_score']} for l in all_leads[:50]])
print(f'Exported top 50 of {len(all_leads)} leads')
return all_leads
run_pipeline()Exemple Python
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def prospect(niche, city):
data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'google', 'query': f'{niche} {city}'}, timeout=10).json()
return [{'name': r['title'], 'url': r.get('link', ''), 'directory_only': 'yelp' in r.get('link', '')}
for r in data.get('organic', [])[:10]]Exemple JavaScript
async function prospect(niche, city) {
const data = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
body: JSON.stringify({platform: 'google', query: `${niche} ${city}`})
}).then(r => r.json());
return (data.organic || []).slice(0, 10).map(r => ({name: r.title, url: r.link}));
}Sortie attendue
A CSV of qualified local business leads scored by opportunity, ready for import into outreach tools like Instantly or Smartlead.