Tutorial

How to Build a Google Maps to WhatsApp Lead Pipeline

Build a pipeline from Google Maps business data to WhatsApp outreach messages. Find local businesses and reach them directly.

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.

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', [])

Step 2: Extract and qualify leads

Filter businesses with phone numbers and no existing website (higher conversion potential).

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

Step 3: Generate personalized WhatsApp messages

Create message templates with business-specific details.

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}

Step 4: Export lead list with WhatsApp links

Save qualified leads with pre-built WhatsApp links.

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 Example

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 Example

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));

Expected Output

JSON
CSV of qualified local business leads with phone numbers, ratings, and pre-built WhatsApp click-to-chat URLs. One search query = $0.005.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Scavio API key. Python 3.8+. WhatsApp Business API or manual outreach workflow. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Build a pipeline from Google Maps business data to WhatsApp outreach messages. Find local businesses and reach them directly.