How to Connect AI to WhatsApp: The Business Platform, Webhooks and Rules

WhatsApp is the front door of Nigerian commerce, so "can the AI answer our WhatsApp?" is the question behind most AI enquiries from Nigerian businesses. The answer is yes, but only through Meta's official platform, and only within rules that trip up businesses that treat WhatsApp like an open messaging pipe. Unofficial tools that automate a normal WhatsApp number risk getting that number banned, which for a business that sells on WhatsApp is a disaster.
This article explains the connection itself: what the platform is, the setup path (direct with Meta or through a Business Solution Provider), how the webhook and messaging flow works, the rules on opt-in, templates and the 24-hour window, handling voice notes, images and documents, human hand-off, what changes for Nigerian businesses, a labelled hypothetical example and indicative costs. What the AI should say and how to design a customer-service or sales bot is covered in the articles on WhatsApp chatbots and WhatsApp customer service automation; this one covers the plumbing that all of them depend on.
WhatsApp Business App vs WhatsApp Business Platform
The WhatsApp Business App is the free phone app most Nigerian SMEs use; it supports a catalogue, labels, quick replies and simple away messages but cannot be connected to a custom AI. The WhatsApp Business Platform (often still called the WhatsApp Business API, with Meta's hosted version called the Cloud API) is the programmable version: messages arrive at your server, your software decides the reply, and you can send approved template messages to opted-in customers.
| Feature | WhatsApp Business App | WhatsApp Business Platform (API) |
|---|---|---|
| Cost | Free | Per-conversation fees from Meta, plus provider fees |
| Custom AI replies | No | Yes, through your backend |
| Multiple agents on one number | Limited | Yes, through your software |
| Outbound messages | Manual | Approved templates to opted-in users |
| Setup | Minutes | Business verification, number registration, webhook setup |
| Best for | Very small businesses, manual selling | Any business automating replies at scale |
Two consequences matter. First, a number cannot be on both at once; moving your main number to the platform is a deliberate migration. Second, unofficial "WhatsApp automation" tools that drive the normal app or web client violate WhatsApp's terms and risk a ban; the platform is the only sanctioned route.
How the connection works end to end
The connection is a loop between the customer, Meta's platform, your backend and the AI model. Understanding the loop clarifies what you must build and what you must buy.
- A customer sends a message to your business number.
- Meta's platform delivers it to your backend through a webhook (an HTTPS endpoint you register). The payload includes the sender's number, the message type (text, image, audio, document, interactive reply) and content or a media ID.
- Your backend authenticates the webhook, stores the message, loads the conversation history and the customer's context, and applies rules (opt-in status, business hours, escalation triggers).
- Your backend retrieves relevant business knowledge (products, prices, delivery areas, order status) and calls the AI model with the conversation and the retrieved context.
- The model returns a reply, possibly with a tool call such as "check order status" that your backend executes first.
- Your backend sends the reply through the platform's messaging endpoint, as free-form text (within the 24-hour window), interactive buttons or lists, or an approved template (outside the window).
- Delivery and read receipts return to your webhook; everything is logged.
The AI model never talks to WhatsApp directly. Your backend is the broker, and it is where rules, knowledge, logging and safety live.
Setup path: direct with Meta or through a BSP?
There are two ways to access the platform: directly through Meta's Cloud API, or through a Business Solution Provider (BSP) that wraps the API in its own platform, dashboard and support. Both lead to the same underlying WhatsApp capability.
| Factor | Direct (Meta Cloud API) | Through a BSP |
|---|---|---|
| Fees | Meta's per-conversation fees only | Meta's fees plus the BSP's platform or markup fees |
| Setup effort | You handle business verification, number registration, webhooks and templates | BSP guides verification and provides tooling |
| Tooling | You build the inbox, template manager and analytics | Usually included: shared inbox, template tools, analytics |
| Control | Full; your code, your data flows | Depends on the BSP; check data-handling terms |
| Support | Meta documentation and developer community | BSP support, often with local presence |
| Best for | Businesses with developers who want control and lowest fees | Businesses that want a managed inbox and faster start |
A reasonable rule: if you are building a custom AI backend anyway and have a developer, go direct or use a BSP that offers raw API access. If you want a ready-made agent inbox with AI added, a BSP is faster. Either way, confirm who owns the phone number and the account, and whether you can move later.
Step-by-step: connecting the AI
The core steps are: choose a number, get verified and registered, set up the webhook, build the reply pipeline with knowledge and rules, prepare templates, build hand-off, test in a sandbox, then go live with monitoring. Here is each step.
- Choose the number. A new number avoids migrating your existing WhatsApp Business App number and its chat history; migrating the existing number keeps customer familiarity. Decide deliberately, because the number cannot run both.
- Complete Meta business verification and register the number on the platform (directly or with a BSP). Set the display name, profile and business description. Verification can take days; start early.
- Set up the webhook. An HTTPS endpoint on your backend, verified with Meta's challenge, authenticated on every request. Store raw messages before processing so nothing is lost during errors.
- Build the reply pipeline. Load conversation state, check opt-in and window status, retrieve business knowledge, call the model with tools for order status, booking and pricing lookups, and send the reply. Keep replies short and use interactive buttons and lists for choices.
- Prepare and submit message templates for confirmations, reminders, order updates and re-engagement. Templates require Meta approval and must follow category rules; plan them alongside the AI's flows.
- Build human hand-off. A trigger word, a sentiment or confusion signal, or a specific topic routes the conversation to a staff inbox; the AI stays silent until the human closes it.
- Add logging and consent records. Every message, model call, template send and hand-off, plus when and how each customer opted in.
- Test with Meta's test numbers and internal staff. Cover voice notes, images, long messages, out-of-hours, and customers who reply "1" or "ok" to everything.
- Go live with a small audience (one product line, one region) and monitor delivery, response time, hand-off rate and per-conversation cost.
- Iterate weekly on knowledge gaps and template wording; watch quality ratings on your number, since low ratings restrict messaging limits.
Meta's rules you must design around
The platform is governed by Meta's Business and Commerce policies, conversation-based pricing and messaging-limit tiers. These rules are not obstacles to the AI; they are constraints the AI flow must be built around. Check Meta's current documentation, because details change.
- Opt-in. You may only send business-initiated messages to customers who have agreed to receive them, and you must be able to show how they opted in (website form, in-chat consent, checkout checkbox). Record it.
- The 24-hour customer service window. After a customer messages you, you can reply freely for 24 hours. Outside that window, you can only send approved template messages. The AI must know which state a conversation is in.
- Templates. Pre-approved message formats with variables, categorised (for example utility, marketing, authentication) with different pricing. Marketing content in a utility template is rejected or reclassified.
- Conversation-based pricing. Fees are charged per conversation category and country; business-initiated conversations differ from user-initiated ones. As of 2026 the model is still evolving; verify current rates for Nigeria.
- Messaging limits and quality rating. Numbers start with a limited number of business-initiated conversations per day and earn higher tiers with volume and good quality; blocks and reports lower the rating and can restrict the number.
- Prohibited content and uses. Certain products and message types are restricted; check the Commerce Policy for your industry.
- Business verification and display name. Required for full access and for customers to see your business name.
Handling voice notes, images and documents
Nigerian customers send voice notes, photos of products and screenshots of bank transfers as a matter of course. A connection that only handles text will fail in the first hour.
- Voice notes: the webhook delivers a media ID; your backend downloads the audio, transcribes it with a speech-to-text model, and passes the text to the AI. Test with Nigerian accents, Pidgin phrases and background noise, and let the AI ask for clarification rather than guess.
- Images: product photos ("do you have this one?") and transfer receipts. Use a multimodal model to describe or extract, but never treat a receipt image as proof of payment; verify against your payment provider's webhook or bank records.
- Documents: PDFs of orders, IDs for KYC, forms. Extract with the same document pipeline you would use elsewhere, and be careful about storing identity documents under the NDPA.
- Location messages: useful for delivery quotes; map them to your delivery zones.
- Interactive replies: buttons and list selections arrive as structured payloads, which makes the AI's job easier; use them wherever choices are fixed.
Media handling costs more per message (transcription and image processing) and takes longer; set expectations with an immediate acknowledgement ("Got your voice note, one moment").
Human hand-off and conversation state
Every AI-on-WhatsApp deployment needs a clean way to pass conversations to people and to keep track of where each conversation is. Hand-off is where many otherwise good bots fail.
- Triggers: an explicit request ("talk to a person"), repeated misunderstanding, complaints, refunds, negotiation, sensitive topics, and anything your rules exclude.
- Mechanics: flag the conversation, notify a staff inbox (a BSP inbox, your own web inbox or an internal alert), and stop the AI replying until the staff member closes the conversation.
- Context transfer: the staff member should see the full conversation and the AI's summary ("customer wants to change delivery address on order 4521").
- After-hours: if no human is available, the AI should say when someone will respond and, where appropriate, send a template follow-up when the office opens.
- State: store per-customer state (current order, booking in progress, last topic) in your database so the AI does not ask for the same details twice.
What changes for Nigerian businesses
Connecting AI to WhatsApp in Nigeria differs from the generic guide in five ways: WhatsApp is the primary sales channel rather than a support add-on, customers pay by bank transfer and send receipts, voice notes and Pidgin are common, connectivity is uneven, and customer data is regulated under the NDPA 2023.
Primary sales channel. Because sales close on WhatsApp, the AI flow must handle enquiry, quote, payment confirmation and delivery updates, not just FAQs. Design tools for order status and payment verification from the start.
Bank transfers and receipts. Customers send transfer screenshots. The AI should acknowledge and route them for verification (ideally automated through a payment provider's virtual accounts and webhooks, or a staff check), never confirm an order on the image alone.
Voice notes and language. Transcription must cope with accents and mixed English and Pidgin. Keep the AI's replies in clear, simple English, with local phrasing where natural.
Connectivity and power. Host the backend in the cloud with a queue so messages that arrive during your own outage are processed later; WhatsApp will retry webhooks for a limited time, so acknowledge quickly and process asynchronously.
Data protection. Phone numbers, conversations, receipts and sometimes identity documents are personal data. Record opt-in, minimise what is sent to the model, secure and expire logs, and check both Meta's and your model provider's data terms. Verify current NDPC guidance; this is not legal advice.
USD fees. Conversation fees and model usage are dollar-denominated. Use user-initiated conversations (which customers start) wherever possible, keep templates for genuinely useful updates, and cap monthly spend.
Example (hypothetical): a fashion brand in Abuja
Example (hypothetical): A ready-to-wear fashion brand in Abuja sells through Instagram and a WhatsApp Business App number handled by two staff. Enquiries peak at night after Instagram posts, customers send voice notes and screenshots, and the team takes hours to reply, losing sales.
The brand registers a new number on the WhatsApp Business Platform through a BSP that offers raw API access and a shared inbox, keeps the old number for existing chats during a transition, and builds a backend that connects to the AI model with tools for product availability, sizes, prices and delivery quotes by state. Voice notes are transcribed; product photos are matched to the catalogue with a multimodal model; transfer screenshots are acknowledged and verified against the payment provider's virtual-account webhook before the AI confirms an order. Templates are approved for order confirmations and dispatch updates, and customers opt in at checkout. Complaints and exchanges hand off to the staff inbox with a summary.
The brand launches with one collection, monitors hand-off rate and per-conversation cost, and later moves Instagram click-to-WhatsApp adverts to the new number. This is an illustrative scenario, not a Linestech client result.
How much does it cost in Nigeria?
The cost of connecting AI to WhatsApp in Nigeria depends on whether you go direct or through a BSP, how many tools and integrations the AI needs, whether media handling is required, and the hand-off tooling. The figures below are indicative 2026 ranges; actual quotes vary with scope, vendor and exchange rate.
| Scope | Indicative one-off cost | Typical contents |
|---|---|---|
| Basic connection: platform setup, webhook, FAQ-level AI replies, hand-off to a BSP inbox | ₦300,000–₦1,500,000 | Verification support, webhook, prompt, small knowledge source, templates |
| Standard: AI with knowledge base and tools (orders, bookings, delivery), media handling, own inbox, logging | ₦1,000,000–₦5,000,000 | Retrieval, tools, transcription, template management, analytics |
| Advanced: payment verification, CRM and e-commerce integration, multi-agent routing, campaigns | ₦3,000,000–₦15,000,000+ | Payment webhooks, CRM sync, workflow engine, dashboards |
Recurring costs, mostly in USD: Meta's conversation fees (verify current Nigerian rates), BSP platform fees if used, model usage including transcription and image processing, hosting at roughly ₦150,000–₦800,000 per year, and maintenance at ₦20,000–₦150,000 per month or a retainer. Compare two or three written quotations on identical scope, and confirm in writing who owns the number, the Meta business account and the code.
Mistakes to avoid
- Using unofficial automation on a normal WhatsApp number. It breaches WhatsApp's terms and risks a ban of the number your business depends on.
- Ignoring the 24-hour window. Free-form replies outside it fail; the AI must switch to templates or wait for the customer.
- No opt-in records. Business-initiated messages without provable consent risk quality-rating penalties and NDPA problems.
- Confirming orders from receipt screenshots. Verify payment through your provider or bank before the AI confirms anything.
- Text-only handling. Voice notes and images are the norm; unsupported media means abandoned conversations.
- No hand-off. Customers trapped with a bot leave and report the number, which lowers your quality rating.
- Slow webhook responses. Acknowledge immediately and process asynchronously, or Meta retries and messages duplicate.
Conclusion
Connecting AI to WhatsApp is a platform and rules exercise before it is an AI exercise. Use the WhatsApp Business Platform (never unofficial automation), decide between direct access and a BSP, build a backend that receives webhooks, tracks the 24-hour window and opt-in, retrieves your business knowledge and calls the model with tools, handles voice notes and images, and hands off cleanly to people. Verify payments through your provider, not screenshots, and watch your quality rating. Indicatively, a first connection costs from around ₦300,000 to ₦5,000,000 in Nigeria, plus USD-denominated conversation and model fees.
If your business sells or supports customers on WhatsApp and you want an AI that replies correctly within Meta's rules, Linestech can help you choose the setup path, build the webhook and reply pipeline, and design the templates and hand-off so the number stays healthy.
Frequently asked questions
Can I connect AI to my existing WhatsApp Business App number?
Not while it remains on the app. You would migrate the number to the WhatsApp Business Platform, which means the app's chat history stays on the phone and the number then operates through the API only. Many businesses start a new platform number and keep the old one during a transition period.
Do I need a Business Solution Provider (BSP)?
No. Meta's Cloud API can be accessed directly, which avoids BSP fees and gives full control, but you build your own inbox and template tooling. A BSP is worthwhile if you want a managed inbox, faster verification support and local help, provided it offers the API access your AI backend needs.
What is the 24-hour window and how does it affect the AI?
After a customer sends a message, your business can reply with free-form messages for 24 hours. After that, you can only send approved template messages until the customer messages again. The AI backend must track each conversation's window state and use templates for reminders, updates and re-engagement outside it.
Can the AI understand voice notes in Nigerian English or Pidgin?
Voice notes are transcribed with a speech-to-text model before the AI reads them. Modern models handle Nigerian English reasonably well; Pidgin and noisy recordings are less reliable. Design the AI to confirm what it understood ("You are asking about the blue kaftan in size L, correct?") and to hand off when unsure.
How much does WhatsApp charge for AI conversations?
Meta charges per conversation, with rates that vary by category (for example utility, marketing, service) and country, and the pricing model has changed over time. As of 2026, verify current Nigerian rates in Meta's documentation. Your AI usage and any BSP fees are separate and also priced in USD.
Is it safe to send customer messages to an AI provider?
Message content sent to the model is processed under the provider's data-handling terms. Send only what each reply needs, avoid passing identity documents or receipts unless required, keep logs secure and time-limited, record opt-in, and document the processing for NDPA 2023 accountability. Review Meta's terms as well. Verify current NDPC guidance; this is not legal advice.
How long does it take to connect AI to WhatsApp?
Business verification and template approval usually take the longest and can run one to three weeks. A basic connection with FAQ-level replies can be live within that time; a standard build with tools, media handling and hand-off typically takes four to eight weeks in total.
Sources and further reading
Figures, platform rules and regulations change. These are the primary references behind this article and the places to check before you act on it.


