Building a Self-Hosted WhatsApp Integration for Lead Follow-Up
A client wanted leads from their contact form followed up over WhatsApp within minutes, not hours — but didn't want to pay for (or trust) a third-party chatbot SaaS with customer phone numbers. Here's the self-hosted approach that worked.
The actual requirement, stripped down
Not a full conversational bot — just: form submission comes in, a WhatsApp message goes out to the lead confirming receipt, and an internal notification goes to the sales team's WhatsApp so they can follow up personally. That's a much smaller problem than "build a chatbot," and it's worth being explicit about that scope before reaching for heavier tooling.
The building blocks
The WhatsApp Business Platform (via the Cloud API, not the older on-prem client) lets you send template messages from your own backend once a business account is verified. Templates need pre-approval from Meta before they can be sent outside a 24-hour customer-initiated window, which is the detail that trips up most first attempts — you can't just send arbitrary text the moment a lead comes in unless it fits an approved template.
The flow that shipped
- Form submission hits the server action, writes the lead to the database (source of truth, independent of WhatsApp delivery succeeding or failing).
- A queued job sends the approved "Thanks, we got your message" template to the lead's number.
- A separate message goes to an internal WhatsApp group/number with the lead's details, so sales can reply from their own phone within the 24-hour window using free-form text.
Splitting "confirm to the lead" (template message) from "notify the team" (also a template, but read by a human who then goes fully free-form) sidesteps most of the Cloud API's messaging-window restrictions.
What actually took the most time
Template approval turnaround from Meta, and getting number verification through business verification — not the integration code itself, which is a fairly standard authenticated REST API. Budget calendar time for the approval process, separate from and ahead of the engineering time.
Takeaway
"Self-hosted" here didn't mean running WhatsApp's infrastructure — it meant owning the data pipeline and not routing customer phone numbers through a third-party SaaS just to send two messages. For a lot of client integrations, that's the actual thing worth optimizing for, not the flashiest possible feature set.