Back to Recipes

WhatsApp Sales Agent

Research leads, draft personalized WhatsApp messages, send outreach, track replies, and escalate warm prospects to human sales.

Best for: Agencies, founders, sales teams, local service businesses

What You Get

  • -Lead research workflow
  • -Message generation with personalization
  • -Follow-up scheduling logic
  • -CRM update automation
  • -Human escalation rule engine

Step by Step

1. Set up the database

Create a PostgreSQL database with tables for leads (id, name, phone, company, role, source, status, enriched_data), messages (id, lead_id, content, direction, status, sent_at), and escalation_log (id, lead_id, reason, assigned_to, resolved_at).

2. Configure WhatsApp Business API

Register for WhatsApp Business API access. Set up a webhook endpoint to receive incoming messages and delivery status callbacks. Configure rate limits (250 messages per day per number for marketing).

3. Build lead import and enrichment

Create an API to accept lead CSV uploads. On import, enrich each lead using OpenAI: extract company info, role seniority, and potential pain points from their website. Store enriched data as JSON in the leads table.

4. Implement message generation

Use OpenAI to generate personalized WhatsApp messages. Prompt should include: lead name, company, role, a relevant pain point, and a clear call to action. Include template variables for fallback.

5. Build the sending pipeline

Create a queue-based sending system that processes leads in batches. Send messages, update status, and handle delivery receipts via webhook. Implement retry logic for failed sends.

6. Track replies and escalate

Parse incoming WhatsApp messages. Use OpenAI to classify intent: interested, not interested, need more info. Auto-escalate interested leads to a human via Slack webhook or CRM task creation.

7. Build the dashboard

Create a simple Next.js dashboard: lead list with status filters, message history view, escalation queue for human review, and stats (sent, delivered, replied, conversion rate).

Stack

WhatsApp Business APIOpenAIPostgreSQLNode.js/Next.jsCRM webhook integration

Build This

Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to build this recipe.

Build me a WhatsApp sales outreach agent. It should: 1) Research leads from a CSV or CRM export and enrich them with LinkedIn/company data via an API. 2) For each lead, generate a personalized WhatsApp message using OpenAI that references their role, company, and a relevant pain point. 3) Send messages via WhatsApp Business API with proper rate limiting and delivery tracking. 4) Track replies and update lead status (sent, delivered, replied, interested, not interested, unsubscribed). 5) Escalate warm leads (replied + interested) to a human sales rep via Slack webhook or CRM task. 6) Log all interactions to a PostgreSQL database with timestamps and message history. Include a simple dashboard to review leads and manually trigger follow-ups.

Common Failure Modes

  • !WhatsApp number not connected to API
  • !Rate limiting from WhatsApp
  • !Message templates rejected by WhatsApp review
  • !Poor personalization from bad lead data

Implementation Notes

Start with 5 test leads before scaling to full list. Verify WhatsApp Business API credentials before building the agent. Use a staging phone number first.

Related skill: whatsapp sales outreach

Want whatsapp sales agent running in your business?

4M Labs can deploy whatsapp sales agent as a production workflow:

  • Connected to your tools and data sources
  • Secured for your team with proper access controls
  • Deployed with monitoring and error handling
  • Documented for handoff and future maintenance
Book an Implementation Sprint