r/coldemail 的一个帖子询问了如何大规模接触小型企业。管道:按类别和位置在 Google 地图上搜索企业,检查他们是否有网站,并进行个性化宣传。本教程构建数据收集和电子邮件撰写步骤。
前置条件
- Scavio API 密钥
- Python 3.8+
- 用于发送的 SMTP 凭据
- 可选:电子邮件验证服务
操作指南
步骤 1: 按类别和地点搜索企业
通过 Scavio 使用 Google 地图查找商家。
Python
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 businesses步骤 2: 从网站查找联系电子邮件
使用 Scavio 提取端点从企业网站提取电子邮件。
Python
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 None步骤 3: 撰写个性化外展电子邮件
生成引用特定业务详细信息的电子邮件。
Python
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')}步骤 4: 导出为 CSV 以导入外展工具
Instantly(30 美元/月)或 Smartlead(39 美元/月)可以导入 CSV 以按顺序发送。
Python
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 示例
Python
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 示例
JavaScript
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());预期输出
JSON
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.