Your WhatsApp AI chatbot can run on any AI model and you can easily switch models at any time without a rebuild. A webhook on your server receives each customer message, and the large language model, or LLM, writes the reply. A Business Solution Provider, or BSP, a company Meta authorizes to offer WhatsApp API access, sends that reply back to the customer. Your bot can reply freely for 24 hours after a customer’s last message and only with approved templates after that. Connecting everything requires basic server-side programming skills and 360Dialog is a leading BSP that can help you with this.
Key Takeaways
- You bring your own LLM and your own code and the BSP provides only the WhatsApp connection.
- You can focus on bot logic while a BSP manages webhook configuration, message delivery, phone number onboarding, and Meta compliance.
- LLM fees in the comparison table run from $0.10 to $2.00 per million input tokens and from $0.50 to $10.00 per million output tokens.
- WhatsApp’s 24-hour customer service window lets your bot send any message type while it is open and only approved templates after it closes.
- 360Dialog, an Official Meta Solution Partner for over 100,000 businesses, connects your bot to the WhatsApp API from €49 per number per month, with no markup on Meta messaging fees.
What Does the Architecture Look Like?
A WhatsApp AI chatbot has three layers: the webhook, the LLM, and the send step. Every conversation turn runs through them in six steps:
- A customer sends a message on WhatsApp.
- Your BSP forwards the message payload to your webhook, an HTTPS endpoint on your server.
- Your server extracts the text and sends it to the LLM API you chose, such as OpenAI, Anthropic, or Google.
- The LLM returns a generated reply.
- Your server posts that reply back to WhatsApp through the BSP’s messaging API.
- The customer sees the response in their WhatsApp chat.
The BSP sits between your server and Meta’s WhatsApp Cloud API so you don’t have to work with Meta’s infrastructure directly. Your code covers everything from receiving the incoming message to composing the outgoing one. You can swap the LLM or add retrieval-augmented generation (RAG) without touching the messaging layer.
Why Do You Need a BSP Between Your Bot and WhatsApp?
A BSP takes the WhatsApp operations work off your engineering team: phone number onboarding, webhook configuration, API authentication, message delivery, and ongoing Meta compliance. You can access Meta’s WhatsApp Cloud API directly, but then you own every operational task yourself: provisioning your phone number, configuring and monitoring webhooks, keeping up with API versioning, and resolving issues with Meta support. A BSP like 360Dialog takes care of this for you.
360Dialog provisions your WhatsApp Business API access, configures your webhook endpoint, issues your API key (the credential your server sends with every request), and provides 24/7 technical support. Your entire chatbot workflow depends on properly configured webhooks. If the webhook goes down, messages stop reaching your LLM until one of Meta’s retries gets through. 360Dialog’s multi-webhook support delivers each incoming message to more than one endpoint. You can route messages to your chatbot and to a separate team inbox at the same time, through the same number.
If you would rather build the bot in a workflow tool than in code, see the full guide on WhatsApp automation and these additional automation methods.
If you want API-level access for a custom chatbot, get API access and connect your number.
Which LLM Should You Choose for a WhatsApp Chatbot?
Choose your LLM by message volume, budget, and how complex your conversations are. The six providers below offer production-ready APIs that suit a WhatsApp chatbot, each with different pricing, context windows, and strengths. To use the models behind ChatGPT, call the OpenAI API, which offers the ChatGPT model as chat-latest. The table compares one recommended model per provider at its most recent published rates.[1][2][3][4][5][6]
| Provider | Model | Input ($/1M tokens) | Output ($/1M tokens) | Context Window | Primary Strength |
|---|---|---|---|---|---|
| OpenAI | GPT-6 Luna | $0.10 | $0.50 | 1.05M tokens | Fast, affordable, high-volume work |
| Anthropic | Claude Sonnet 5.5 | $2.00 | $10.00 | 1M tokens | Speed and intelligence balance, large context |
| Gemini 3.8 Flash | $0.75 | $3.75 | 1M tokens | Free tier available, 1M context, agentic | |
| Perplexity | sonar (Agent API) | $0.25 | $2.50 + $2.50/1K web searches | Not published | Built-in web search, grounded answers |
| Azure OpenAI | GPT-6 Luna* | $0.10 | $0.50 | 1.05M tokens | Enterprise compliance, data residency |
| xAI | Grok 4.7 | $2.00 | $6.00 | 500K tokens | Strong coding, configurable reasoning |
*Azure OpenAI prices shown are for the Global deployment type and match OpenAI’s list prices. Data Zone deployments cost $0.11 input and $0.55 output per million tokens. Perplexity’s Agent API adds $2.50 per 1,000 web searches to token costs, and Perplexity ended support for Sonar Chat Completions on September 27, 2026. Google’s Gemini 3.8 Flash prices apply through December 31, 2026. From January 1, 2027, they double to $1.50 input and $7.50 output per million tokens. Prices subject to change at any time, see the original sources below for up to date information.
For high-volume customer service bots with short exchanges, GPT-6 Luna has the lowest per-token cost in the table. If your chatbot must answer from current data, OpenAI, Google Gemini, Perplexity, and xAI’s Grok all offer built-in web search.
Microsoft Copilot fits this architecture in two ways. Your own webhook server can reach a Copilot Studio agent through Microsoft’s Direct Line API: Your server relays the WhatsApp message to the agent and sends its answer back through your BSP.[7] Microsoft’s own WhatsApp channel for Copilot Studio runs through Azure Communication Services, outside a BSP. It stopped accepting new WhatsApp connections after October 23, 2026, and agents connected before that date keep working.[8] For a new build, use the Direct Line route through your BSP. Azure OpenAI, listed in the table, is Microsoft’s model API.
How Do You Connect Your Chatbot in Three Steps?
You connect your chatbot to WhatsApp through 360Dialog in three steps: set your webhook, call your LLM, and send the reply. The 360Dialog API needs one authentication header and a straightforward JSON payload. That keeps the integration code on your side minimal. Once your webhook is live and your API key is active, every incoming WhatsApp message reaches your endpoint automatically.
Step 1: Set Your Webhook
Register your HTTPS endpoint with 360Dialog so incoming messages reach your server. Your webhook server needs a valid TLS or SSL certificate, and self-signed certificates are not supported. Answer each valid notification with HTTP status 200. If a delivery fails, Meta retries it at once and then less and less often for 7 days. Any notification still unacknowledged after 7 days is dropped. Deduplicate notifications on your server, because a retry can repeat one you already received.[9]
Step 2: Call Your LLM
When your webhook receives a message, extract the text and send it to your chosen LLM API. Add any system prompt, conversation history, or RAG context your use case requires. The LLM returns a generated response.
Step 3: Send the Reply
Post the LLM’s response back to WhatsApp through the 360Dialog messaging API:
Endpoint: POST https://waba-v2.360dialog.io/messages
Header: D360-API-KEY: your-api-key
Body:
{
"messaging_product": "whatsapp",
"to": "<CUSTOMER_PHONE_NUMBER>",
"type": "text",
"text": {
"body": "Your generated reply here"
}
}
Meta recommends writing the recipient’s phone number with a plus sign and the country code. The to field accepts plus signs, hyphens, parentheses, and spaces.[10]
What Is the 24-Hour Rule for Chatbots?
WhatsApp gives every business number a 24-hour customer service window, and the window decides what your chatbot may send. It opens when a customer messages or calls your business number.[11] While it is open, your chatbot can send any type of message: text, images, documents, interactive lists, or buttons. After it closes, every message your bot sends, including a proactive follow-up, has to be a template that Meta approved in advance.
Design your conversations around this rule. If a customer goes quiet for 24 hours and then writes again, their new message resets the window.
Since October 1, 2026, Meta charges per message for service messages sent within the 24-hour window, at the same rates by market as utility and authentication messages.[12] Each business phone number gets 1,000 free service messages a month, and Meta charges from the 1,001st. Unused free messages don’t roll over to the next month. Utility template messages sent inside an open window are charged as well.
Replies written by a third-party AI count as service messages. A chatbot that resolves queries in fewer turns uses fewer billable messages. Meta’s AI Providers policy, in force since January 15, 2026, lets a general-purpose AI assistant use the WhatsApp Business Platform only where Meta is legally required to allow it.[13] The policy leaves Meta’s charges for all other businesses unchanged. If your chatbot answers for your own business, its replies are billed as service messages.
When Should the Bot Step Aside?
Your bot should hand the conversation to a human agent when it reaches its limits, and a reliable handoff is as important as the bot logic itself. Trigger the handoff when the customer explicitly asks for a human, when the LLM’s confidence drops below a threshold you define, or when a defined number of turns pass without resolution. Trigger it too when the conversation enters a topic your bot is not trained on, such as billing disputes, legal questions, or complaints. Your chatbot should tell the customer a human agent is taking over, then stop generating responses for that thread.
With 360Dialog’s multi-webhook routing, your bot and your team inbox can run on the same WhatsApp number. When a handoff triggers, your application flags the conversation for a human agent in your helpdesk or inbox tool.
What Does Your API Provider Not Do?
Your API provider leaves the chatbot itself to you: Your chatbot logic, LLM, prompts, conversation history, and LLM billing stay on your side. 360Dialog provides the WhatsApp API infrastructure underneath.
When your LLM provider raises prices or a better model launches, the API-layer approach lets you switch: You replace the LLM call in your code and everything else stays the same.
Why 360Dialog?
As an Official Meta Solution Partner, 360Dialog runs the WhatsApp API infrastructure for over 100,000 businesses and 2B+ messages a month. Plans start from €49 per number per month, with no markup on Meta messaging fees. Incoming messages reach your webhook in real time, and every reply goes out through a single messaging endpoint. When something goes wrong at the WhatsApp infrastructure level, our 24/7 support team handles it, and your engineering team stays focused on the bot.
For teams that prefer a no-code path, the integrations page covers workflow tools such as Zapier, n8n, and Make. Meta Business Agent is Meta’s own AI agent, a separate option if you don’t want to run your own LLM.
If you want your chatbot sending WhatsApp messages from the LLM you choose, get API access for your number.
Frequently Asked Questions
Do I Need Coding Skills to Build a WhatsApp AI Chatbot?
Building a custom WhatsApp AI chatbot takes basic server-side programming skills. At minimum, you set up an HTTPS webhook endpoint, make HTTP requests to an LLM API, and post a JSON payload to the 360Dialog messaging API. Python, Node.js, PHP, and any language with an HTTP library will work.
How Much Does It Cost to Run a WhatsApp AI Chatbot?
A WhatsApp AI chatbot has three costs: WhatsApp API access through your BSP, Meta’s charge for service messages your bot sends inside the 24-hour window, and LLM API usage. 360Dialog plans start from €49 per number per month with no markup on Meta fees. Meta gives each business phone number 1,000 free service messages a month, with no roll-over, and charges from the 1,001st at rates that vary by market.
At the lowest end, OpenAI’s GPT-6 Luna charges $0.10 per million input tokens and $0.50 per million output tokens.
Can My Chatbot Send Messages Outside the 24-Hour Window?
Outside the 24-hour customer service window, your chatbot can send only pre-approved template messages. WhatsApp starts the 24-hour timer when a customer messages or calls your business number. While the window is open, any message type is permitted. Once it closes, freeform messages are blocked until the customer contacts you again.
What Happens If My Webhook Goes Down?
If your webhook does not answer a notification with HTTP status 200, Meta treats the delivery as failed. It retries at once and then less and less often for 7 days, and drops any notification still unacknowledged after 7 days. Retries can arrive as duplicates. Sustained downtime therefore leaves your bot a backlog to deduplicate and work through.
With 360Dialog’s multi-webhook support, each incoming message can also go to a second endpoint, such as a logging service.
How Is a Custom AI Chatbot Different From Meta Business Agent?
A custom AI chatbot runs on the LLM, prompts, and conversation logic you choose, and it reaches WhatsApp through your BSP. Meta Business Agent is Meta’s own AI agent for business messaging. Our comparison of Meta Business Agent vs a third-party AI agent shows when each one fits.
Sources
[1] OpenAI API Pricing. https://developers.openai.com/api/docs/pricing (accessed October 22, 2026).
[2] Anthropic Claude Models Overview. https://platform.claude.com/docs/en/models/overview (accessed October 22, 2026).
[3] Google Gemini API Pricing. https://ai.google.dev/gemini-api/docs/pricing (accessed October 22, 2026).
[4] Perplexity Agent API Models. https://docs.perplexity.ai/docs/agent-api/models (accessed October 22, 2026).
[5] Azure OpenAI Service Pricing. https://azure.microsoft.com/en-us/pricing/details/azure-openai/ (accessed October 22, 2026).
[6] xAI Grok Models. https://docs.x.ai/developers/models (accessed October 22, 2026).
[7] Microsoft Copilot Studio: Connect Your Agent to a Custom Application (Direct Line API). https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-connect-bot-to-custom-application (accessed October 22, 2026).
[8] Microsoft Copilot Studio: Publish an Agent to WhatsApp. https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-add-bot-to-whatsapp (accessed October 22, 2026).
[9] Meta WhatsApp Cloud API: Create a Webhook Endpoint. https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/create-webhook-endpoint (accessed October 22, 2026).
[10] Meta WhatsApp Cloud API: Service Messages. https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/send-messages (accessed October 22, 2026).
[11] Meta WhatsApp Pricing: Pricing on the WhatsApp Business Platform. https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing (accessed October 22, 2026).
[12] Meta WhatsApp Pricing: Upcoming Pricing Updates for Meta Business Agent, Service and Utility Messages. https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing/non-template-messages (accessed October 22, 2026).
[13] Meta WhatsApp Pricing: New Pricing Policy for AI Providers. https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing/ai-providers/ (accessed October 22, 2026).




