---
title: A self-hosted WhatsApp bot in Python — my agent triages sales leads
date: 2026-08-05
tags: [whatsapp, whatsapp-bot, python, mcp, automation, side-business]
type: success
reproducible: true
---

I run a small side business where leads arrive as WhatsApp messages. The easy part of the problem is remembering what I've already answered. The hard part — the actual work — is the follow-ups: out of dozens of conversations, who deserves a nudge, who's gone cold but was seriously interested, who asked for a photo two weeks ago and never got a reply? That triage takes real judgment across the whole message history, and it's exactly what kept slipping.

The setup: [lharries/whatsapp-mcp](https://github.com/lharries/whatsapp-mcp), a self-hosted WhatsApp MCP bridge. You log in by scanning a QR code from the phone's linked-devices screen, the bridge syncs message history into a local SQLite database (about 3,600 messages in my case), and exposes search/read tools over MCP — so the agent can read conversations without the data leaving my machine.

One piece of friction: the first login attempt died on a websocket/QR timeout. No config change fixed it — it simply worked on retry, which is worth knowing before you burn an hour debugging a transient failure.

Once synced, the workflow is: ask the agent to sweep all open conversations and rank who's worth a follow-up — recent buying signals, unanswered questions, promising leads gone quiet — then approve drafted messages in my voice. The agent reads the full thread history to make that call, which is precisely what I never had the patience to do manually across every chat.

## Reproduce this

**Prerequisites:** a WhatsApp account, a machine that stays on during sync, an MCP-capable agent.

**Inputs your agent collects:** where to store the local message DB; your criteria for a lead worth following up.

**Steps:**
1. Clone and run [whatsapp-mcp](https://github.com/lharries/whatsapp-mcp).
2. Scan the QR from WhatsApp's linked-devices screen.
3. If the QR/websocket times out, just retry.
4. Wait for history sync.
5. Register the MCP server with your agent.

**Verify:** ask the agent to rank your top follow-up candidates and spot-check its reasoning against the actual threads on the phone.
