DEV Community

Lex Na
Lex Na

Posted on

Connecting AI to WhatsApp Business API — Lessons from 1000+ SME Deployments

We built HeyMag to connect AI assistants to WhatsApp Business numbers for SMEs across Southeast Asia. Here's what we learned.

WhatsApp Business API Quirks

The WhatsApp Business API has some non-obvious constraints that will trip you up if you're coming from building chatbots on other platforms:

  • 24-hour messaging windows — you can only send free-form messages within 24 hours of the customer's last message. After that, you need pre-approved template messages.
  • Template messages need pre-approval — Meta reviews every outbound template. Expect 24-48 hours for approval. Plan your flows around this.
  • Media handling requires specific formatting — images, documents, and location pins each have their own payload structure. PDFs max out at 100MB.
  • Rate limits scale with your quality rating — Meta assigns your number a quality rating based on user blocks and reports. Low quality = severe rate limits.

What Actually Matters for AI Integration

Building the AI part was the easier half. The hard part was making it work for real businesses with real customers:

  • Context window management — WhatsApp conversations are long-running, not session-based. A customer might message Monday, disappear, then reply Thursday referencing Monday's conversation. Your AI needs to handle this gracefully.
  • Language switching — customers in Singapore switch between English, Mandarin, and Singlish mid-conversation. Sometimes mid-sentence. Your model needs to handle code-switching without breaking.
  • Escalation design — knowing when to hand off to a human is more important than the AI being perfect. We use confidence scoring plus keyword triggers for escalation.
  • Response latency — customers expect sub-3-second replies on WhatsApp. If your AI takes 8 seconds, they've already opened another tab. We pre-generate responses for common patterns and stream the rest.

The Biggest Lesson

SME owners don't care about your AI model. They don't care about your architecture or your prompt engineering. They care about one thing: did customers stop complaining about slow replies?

Ship fast, iterate on accuracy. A mediocre AI that replies in 2 seconds beats a perfect AI that takes 10 seconds. Every time.

The second biggest lesson: WhatsApp's 90%+ open rate in Southeast Asia makes email look like sending letters by carrier pigeon. If you're building customer-facing AI for this region, WhatsApp is the channel.

More at heymag.app.

Top comments (0)