WhatsApp Business API Overview
WhatsApp is the world's most popular messaging app with 2+ billion users. Unlike Telegram or SMS, WhatsApp has a 98% message open rate and most users check it within minutes. For businesses, this makes WhatsApp the highest-engagement customer communication channel available.
The WhatsApp Business API (now called Cloud API by Meta) allows businesses to:
- Send and receive messages programmatically
- Use message templates for outbound notifications
- Handle rich media (images, documents, audio, location)
- Build automated chatbot flows
- Integrate with CRMs and automation platforms like n8n
Business impact:Businesses using WhatsApp AI bots report 3–5x higher customer engagement compared to email, and response rates 10x higher than traditional web chatbots. This is the channel your clients' customers are already using.
Prerequisites
Before building, you'll need these accounts and assets:
- Meta Business Manager account — business.facebook.com
- Facebook Business Page — linked to your Business Manager
- Verified phone number — not currently used on WhatsApp personal app
- Meta App with WhatsApp product — created in developers.facebook.com
- n8n instance — self-hosted or n8n Cloud
- OpenAI API key — from platform.openai.com
Setting Up WhatsApp in Meta Developer Portal
- Go to developers.facebook.com and create an App (Business type)
- Add the WhatsApp product to your app
- In WhatsApp → Getting Started, add a phone number
- Copy your Phone Number ID and WhatsApp Business Account ID
- Generate a System User Access Token in Business Manager (permanent token, not 24h)
- In WhatsApp → Configuration, set your Webhook URL to your n8n webhook URL
- Subscribe to messages webhook field
- Verify the webhook with a token you define
# Webhook verification in n8n:
# WhatsApp will send a GET request with:
# ?hub.mode=subscribe
# ?hub.verify_token=YOUR_TOKEN
# ?hub.challenge=RANDOM_NUMBER
#
# Your n8n webhook must respond with hub.challenge
# Configure in Respond to Webhook node:
{{ $query['hub.challenge'] }}Setting Up WhatsApp in n8n
Add your WhatsApp credentials to n8n:
- Go to Settings → Credentials → Add Credential
- Search for WhatsApp Business Cloud
- Enter your Access Token, Phone Number ID, and WhatsApp Business Account ID
- Save the credential
Receiving and Parsing Messages
Create a new workflow with a Webhook trigger (POST method). WhatsApp sends message events in this format:
{
"entry": [{
"changes": [{
"value": {
"messages": [{
"from": "15551234567",
"type": "text",
"text": { "body": "Hello, I need help with my order" },
"timestamp": "1234567890"
}]
}
}]
}]
}In n8n, use a Set node to extract the key fields:
// Extract message data
phone_number: {{$json.entry[0].changes[0].value.messages[0].from}}
message_text: {{$json.entry[0].changes[0].value.messages[0].text.body}}
message_type: {{$json.entry[0].changes[0].value.messages[0].type}}OpenAI Integration for Smart Replies
After extracting the message, add an AI Agent node with:
- Chat Model: OpenAI GPT-4o-mini
- Memory: Simple Memory with session key set to
{{$json.phone_number}} - System Prompt: Your business context and personality
- User Input:
{{$json.message_text}}
Then add a WhatsApp node to send the reply:
// WhatsApp send message configuration:
{
"to": "{{phone_number}}",
"type": "text",
"text": {
"body": "{{$json.output}}"
}
}Handling Images and Voice Notes
WhatsApp users frequently send photos and voice messages. Here's how to handle each:
Image Processing
- Check if
message_type === "image" - Extract image ID:
{{$json.entry[0].changes[0].value.messages[0].image.id}} - Download image URL via WhatsApp Media API:
https://graph.facebook.com/v18.0/{media_id} - Pass the image URL to GPT-4o vision with the question "What's in this image? Help the user based on what you see."
Voice Note Processing
- Check if
message_type === "audio" - Download the OGG audio file from WhatsApp
- Pass to OpenAI Whisper node for transcription
- Use the transcribed text as the chat input
- Optionally reply with both text and a voice note (using ElevenLabs TTS)
Building a Product Catalog Bot
For e-commerce, build a WhatsApp bot that lets customers browse products and place orders:
- Welcome message — when new contact messages for first time
- Quick reply buttons — "Browse Products", "Track Order", "Get Support"
- Product search — AI understands natural language queries like "show me red sneakers under €80"
- Product cards — WhatsApp supports media messages with product images
- Order intent detection — "I want to order 2 of those" triggers order flow
// WhatsApp interactive message with buttons
{
"type": "interactive",
"interactive": {
"type": "button",
"body": {
"text": "Welcome to ShopName! How can I help you today?"
},
"action": {
"buttons": [
{"type": "reply", "reply": {"id": "browse", "title": "Browse Products"}},
{"type": "reply", "reply": {"id": "order_status", "title": "Track Order"}},
{"type": "reply", "reply": {"id": "support", "title": "Get Help"}}
]
}
}
}Lead Qualification via WhatsApp
For B2B businesses, a WhatsApp lead qualification bot can replace traditional contact forms:
- User sends "Hi, interested in your services"
- Bot asks qualifying questions: company size, budget, timeline, specific needs
- After collecting answers, AI scores the lead (hot/warm/cold)
- Hot leads: immediate calendar booking link + notify sales team via Slack
- Warm leads: add to email nurture sequence + follow up in 3 days
- Cold leads: send useful content, check back in 30 days
All data is automatically synced to your CRM (HubSpot, Pipedrive) via n8n. Sales reps see qualified leads with full conversation context before they even pick up the phone.
Order Processing Workflow
For restaurants or physical product businesses, build an end-to-end order bot:
Customer: "I'd like to order 2 margherita pizzas"
Bot: "Great choice! That's 2x Margherita (€10 each).
Total: €20. Can I get your delivery address?"
Customer: "123 Main Street"
Bot: "Got it! Payment options:
1. Cash on delivery
2. Card via link"
Customer: "Cash please"
Bot: "Order confirmed! 🍕
Order #847 — estimated delivery: 35-45 minutes
We'll message you when the driver is on the way."
// n8n workflow sends order to kitchen system + driver app
// Customer receives delivery notifications automaticallyThis entire flow can be built in n8n without code using the WhatsApp node, OpenAI for natural language understanding, and HTTP Request to connect to your ordering system.
Ready to sell WhatsApp automation? Restaurants, clinics, and real estate agencies all have high WhatsApp usage and clear automation needs. Our AI Chatbot course (€59) includes a complete WhatsApp bot template with ordering logic, FAQ handling, and client delivery documentation.