r/coldemail 帖子询问如何通过 WhatsApp 而不是电子邮件联系当地企业。流程:在 Google 地图上查找商家、提取电话号码、撰写个性化 WhatsApp 消息。本教程构建了数据收集和消息生成步骤。
前置条件
- Scavio API 密钥
- Python 3.8+
- WhatsApp Business API 或手动外展工作流程
操作指南
步骤 1: 在 Google 地图上搜索本地商家
使用 Scavio 按类别和位置查找企业。
Python
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', [])步骤 2: 提取并限定潜在客户
过滤具有电话号码且没有现有网站的企业(更高的转化潜力)。
Python
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 qualified步骤 3: 生成个性化 WhatsApp 消息
创建包含特定于业务的详细信息的消息模板。
Python
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}步骤 4: 导出带有 WhatsApp 链接的潜在客户列表
使用预先构建的 WhatsApp 链接保存合格的潜在客户。
Python
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 示例
Python
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 示例
JavaScript
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));预期输出
JSON
CSV of qualified local business leads with phone numbers, ratings, and pre-built WhatsApp click-to-chat URLs. One search query = $0.005.