An r/coldemail thread asked about reaching local businesses via WhatsApp instead of email. The pipeline: find businesses on Google Maps, extract phone numbers, compose personalized WhatsApp messages. This tutorial builds the data collection and message generation steps.
Prerequisites
- Scavio API key
- Python 3.8+
- WhatsApp Business API or manual outreach workflow
Walkthrough
Step 1: Search Google Maps for local businesses
Use Scavio to find businesses by category and location.
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def find_businesses(category, location):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=H,
json={'platform': 'google', 'query': f'{category} in {location}',
'type': 'maps'}).json()
return data.get('local_results', [])Step 2: Extract and qualify leads
Filter businesses with phone numbers and no existing website (higher conversion potential).
def qualify_leads(businesses):
qualified = []
for b in businesses:
phone = b.get('phone')
website = b.get('website')
if phone:
qualified.append({
'name': b.get('title'),
'phone': phone,
'address': b.get('address'),
'rating': b.get('rating'),
'has_website': bool(website),
'reviews': b.get('reviews', 0)
})
return qualifiedStep 3: Generate personalized WhatsApp messages
Create message templates with business-specific details.
def whatsapp_message(lead, your_service):
name = lead['name']
msg = (f'Hi, I came across {name} and noticed you have great reviews '
f'({lead["rating"]} stars). I help local businesses like yours with '
f'{your_service}. Would you be open to a quick chat?')
# WhatsApp click-to-chat URL
phone_clean = lead['phone'].replace(' ', '').replace('-', '').replace('(', '').replace(')', '')
wa_url = f'https://wa.me/{phone_clean}?text={requests.utils.quote(msg)}'
return {'message': msg, 'wa_url': wa_url}Step 4: Export lead list with WhatsApp links
Save qualified leads with pre-built WhatsApp links.
import csv
def export_leads(leads, service, filename='leads.csv'):
with open(filename, 'w', newline='') as f:
w = csv.DictWriter(f, fieldnames=['name', 'phone', 'rating', 'reviews', 'wa_url'])
w.writeheader()
for lead in leads:
msg = whatsapp_message(lead, service)
lead['wa_url'] = msg['wa_url']
w.writerow({k: lead.get(k) for k in w.fieldnames})Python Example
import os, requests
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
leads = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'google', 'query': 'plumber in Austin TX', 'type': 'maps'}).json()
for biz in leads.get('local_results', []):
if biz.get('phone'):
print(f"{biz['title']}: {biz['phone']}")JavaScript Example
const res = 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: 'plumber in Austin TX', type: 'maps'})
});
const data = await res.json();
data.local_results?.filter(b => b.phone).forEach(b => console.log(b.title, b.phone));Expected Output
CSV of qualified local business leads with phone numbers, ratings, and pre-built WhatsApp click-to-chat URLs. One search query = $0.005.