How to Connect an AI Chatbot to WhatsApp
WhatsApp is where a lot of your customers already are — but connecting an AI chatbot to it doesn't go through a simple API key like most integrations. It goes through Meta's WhatsApp Cloud API, which means a Meta developer account, a Business app, and a webhook handshake before the first message goes through. None of it is hard, but every step has a specific place to click and a specific thing to copy, so here's the whole path in order.
What you're actually setting up
There's no "WhatsApp chatbot" product you install — WhatsApp Business messaging runs through Meta's own Cloud API, and a platform like BotBuild plugs into it as a webhook endpoint: WhatsApp forwards incoming messages to your bot's URL, the bot generates a reply the same way it would in the website widget, and sends it back through the same API. That's why the setup lives on Meta's side first — you're authorizing Meta to talk to your bot, not signing up for a new chat product.
Step by step: Meta Cloud API setup
- Create a Meta Developer account. Go to developers.facebook.com and log in with your Facebook account, completing verification if you're new.
- Create a new App. Click "Create App," choose type Business, and give it a name — your brand plus "Bot" works fine.
- Add the WhatsApp product. On the App Dashboard, under "Add products to your app," find WhatsApp and click Set Up. This adds the WhatsApp Business Platform to your app.
- Copy your Phone Number ID. In the sidebar, go to WhatsApp → API Setup. Under "Send and receive messages" you'll see a test number (or your linked number) with a Phone Number ID underneath it — that's what your bot platform needs.
- Generate a permanent access token. The token shown on the API Setup page expires in 24 hours — fine for testing, useless in production. For a permanent one: Business Settings → Users → System Users → add a System User with Admin role → Generate New Token → select your app → grant
whatsapp_business_messagingandwhatsapp_business_managementpermissions → copy the token immediately, since it's shown only once. - Add a real phone number for production. The test number only sends to numbers you've explicitly added. For a real number: WhatsApp → API Setup → Phone Numbers → Add Phone Number. It needs a verified WhatsApp Business Account and can't already be registered on WhatsApp; you'll verify it with a 6-digit OTP.
- Configure the webhook. Your bot platform generates a Callback URL and a Verify Token — paste both into WhatsApp → Configuration → Webhook → Edit, click Verify and Save, then subscribe to the
messagesfield under Webhook Fields. This is the step that actually connects Meta to your bot; skip it and messages never arrive. - Save and test. Save your bot-side settings first so the Callback URL and Verify Token exist, then finish the Meta webhook step, then send a WhatsApp message to the connected number. A reply within seconds means it's wired correctly end to end.
The constraints that catch people off guard
The setup steps are mechanical; the WhatsApp Business Platform's actual rules are what trip people up after launch:
- Real numbers need business verification. A verified Meta Business Account is required to add a production phone number, and approval typically takes 1–3 days — don't plan a same-day launch around it.
- There's a free tier, then it's paid. Meta includes 1,000 free service conversations per month per phone number; beyond that, conversations are billed by Meta directly.
- The 24-hour reply window is a hard rule, not a suggestion. Once 24 hours pass since a customer's last message, you can't send a free-form reply — only pre-approved Message Templates. A bot that tries to follow up outside that window with a normal message will simply fail to send.
- Tokens expire unless you do it right. The quick token from the API Setup screen is a 24-hour throwaway. Skip the permanent System User token step and your integration silently stops working the next day.
What the bot actually needs to know
A WhatsApp connection reuses the same knowledge base and confidence-threshold behavior as your website widget — it isn't a separate bot you train twice. If you've already set up training data following how to train an AI chatbot on your own data, WhatsApp messages get answered from the same source content, with the same "I don't know" fallback when nothing relevant matches — see how to reduce AI chatbot hallucinations for why that fallback matters even more on a channel where a wrong answer feels like a text from a real person.
Quick checklist before you go live
- Permanent System User token generated — not the 24-hour default.
- Webhook verified and subscribed to the
messagesfield. - Real phone number added and business verification started, if you're going beyond the test number.
- Bot tested with real questions on the test number before pointing customers at the production one.
- A plan for the 24-hour window — either accept it, or set up Message Templates for anything that needs to go out later.
Skip the manual webhook plumbing
BotBuild generates your Callback URL and Verify Token automatically and walks you through every Meta step in-app — WhatsApp is included on Pro and higher.
Start free — no credit card required