An r/coldemail thread asked about reaching small businesses at scale. The pipeline: search Google Maps for businesses by category and location, check if they have websites, and compose personalized outreach. This tutorial builds the data collection and email composition steps.
Prerequisites
- Scavio API key
- Python 3.8+
- SMTP credentials for sending
- Optional: email verification service
Walkthrough
Step 1: Search for businesses by category and location
Use Google Maps via Scavio to find businesses.
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def find_smbs(category, city, state):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=H,
json={'platform': 'google', 'query': f'{category} in {city} {state}',
'type': 'maps'}).json()
businesses = []
for b in data.get('local_results', []):
businesses.append({
'name': b.get('title'),
'address': b.get('address'),
'phone': b.get('phone'),
'website': b.get('website'),
'rating': b.get('rating'),
'reviews': b.get('reviews', 0),
})
return businessesStep 2: Find contact emails from websites
Extract email from the business website using Scavio extract endpoint.
def find_email(website):
if not website:
return None
try:
data = requests.post('https://api.scavio.dev/api/v1/extract',
headers=H,
json={'url': website}).json()
text = data.get('text', '')
# Simple email extraction
import re
emails = re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', text)
# Filter out generic emails
generic = ['noreply', 'no-reply', 'support', 'info']
personal = [e for e in emails if not any(g in e.lower() for g in generic)]
return personal[0] if personal else (emails[0] if emails else None)
except:
return NoneStep 3: Compose personalized outreach emails
Generate emails that reference specific business details.
def compose_email(business, your_service):
name = business['name']
rating = business.get('rating', '')
reviews = business.get('reviews', 0)
subject = f'Quick question for {name}'
body = (f'Hi,\n\n'
f'I found {name} on Google Maps'
f'{f" -- {rating} stars with {reviews} reviews, nice work" if rating else ""}.\n\n'
f'I help businesses like yours with {your_service}. '
f'Would it be worth a 5-minute conversation this week?\n\n'
f'Best regards')
return {'subject': subject, 'body': body, 'to': business.get('email')}Step 4: Export as CSV for import into outreach tool
Instantly ($30/mo) or Smartlead ($39/mo) can import the CSV for sequenced sending.
import csv
def export_outreach(businesses, service, filename='outreach.csv'):
with open(filename, 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=['name', 'email', 'subject', 'body', 'phone', 'website'])
writer.writeheader()
for b in businesses:
if b.get('email'):
email = compose_email(b, service)
writer.writerow({'name': b['name'], 'email': b['email'],
'subject': email['subject'], 'body': email['body'],
'phone': b.get('phone', ''), 'website': b.get('website', '')})
print(f'Exported {filename}')Python Example
import os, requests, re
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def smb_pipeline(category, city):
maps = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'google', 'query': f'{category} in {city}', 'type': 'maps'}).json()
for biz in maps.get('local_results', []):
if biz.get('website'):
page = requests.post('https://api.scavio.dev/api/v1/extract', headers=H,
json={'url': biz['website']}).json()
emails = re.findall(r'[\w.+-]+@[\w-]+\.[\w.]+', page.get('text', ''))
if emails: print(f"{biz['title']}: {emails[0]}")JavaScript Example
const maps = 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: `dentist in ${city}`, type: 'maps'})
}).then(r => r.json());Expected Output
CSV of SMB leads with business name, email, phone, and personalized outreach email. Maps search + website extraction per lead. Compatible with Instantly or Smartlead for sequenced sending.