WhatsApp Business API Setup
Complete step-by-step guide to set up WhatsApp Business API and integrate it with your Team Inbox.TL;DR - Quick Setup
Create Meta Business Account
Create WhatsApp App
Get Credentials
Setup Webhook
messagesOverview
To use WhatsApp Team Inbox, you need:Meta Business Account
WhatsApp Business App
Phone Number
API Access
Prerequisites
Before starting, ensure you have:Step 1: Create Meta Business Account
Go to Meta Business Suite
Create Business Portfolio
- Enter your business name
- Provide business details
- Add a business email
Verify Your Business Email
Step 2: Create WhatsApp Business App
Access App Creation
- In Meta Business Suite, go to Business Settings
- Click Accounts → Apps
- Click Add → Create a New App
Select App Type
Configure App Details
- App Name: WhatsApp Team Inbox (or your preferred name)
- App Contact Email: Your support email
- Business Portfolio: Select your business account
Add WhatsApp Product
- In your app dashboard, find WhatsApp product
- Click Set Up to add WhatsApp to your app
Step 3: Configure WhatsApp Business Profile
Access WhatsApp Settings
Add Phone Number
- Click Add Phone Number
- Enter your business phone number
- Choose SMS or voice call for verification
- Enter the verification code you receive
Set Up Business Profile
- Business Name: Your company name
- Category: Select appropriate business category
- Description: Brief about your business
- Profile Photo: Upload your logo (640x640px recommended)
- Address: Business address (optional)
- Website: Your website URL
Step 4: Get API Credentials
Phone Number ID
Navigate to API Setup
Copy Phone Number ID
WHATSAPP_PHONE_NUMBER_ID in your .env file.Access Token
Create System User
- Go to Business Settings → Users → System Users
- Click Add and create a new system user:
- Name: WhatsApp Team Inbox API
- Role: Admin
Assign Assets
- Click on your system user
- Click Add Assets
- Select your WhatsApp app
- Enable Full Control
- Click Save Changes
Generate Access Token
- Click Generate New Token
- Select your WhatsApp app
- Set token expiration to Never
- Select permissions:
whatsapp_business_messagingwhatsapp_business_management
- Click Generate Token
- Copy and save the token immediately (it won’t be shown again)
WHATSAPP_ACCESS_TOKEN in your .env file.Business Account ID
Find Business Account ID
- Go to Business Settings → WhatsApp Accounts
- Copy the WhatsApp Business Account ID
WHATSAPP_BUSINESS_ACCOUNT_ID in your .env file.Step 5: Configure Webhook
Webhooks allow WhatsApp to send incoming messages to your Team Inbox.Generate Verify Token
First, create a random verification token:WHATSAPP_WEBHOOK_VERIFY_TOKEN in your .env file.
Set Up Webhook in Meta
Access Webhook Configuration
Enter Webhook Details
Subscribe to Webhook Fields
- ✅ messages - Receive incoming messages
- ✅ message_status - Receive message delivery status (sent, delivered, read)
Test Webhook Connection
Step 6: Test Configuration
Send Test Message
Use the API Test tool in Meta Business Suite:Access API Test Tool
Send Test Message
- Select a recipient phone number (can be your own number)
- Choose a message type (text message recommended for testing)
- Enter message content
- Click Send Message
Verify Receipt
- Message appears in WhatsApp on recipient’s phone
- Your Team Inbox receives the message via webhook
- Backend logs show successful webhook processing
Verify Environment Variables
Ensure all required variables are set in your.env file:
API Limits & Pricing
Free Tier (Cloud API)
Test Mode
- 5 conversations per day
- Message template testing
- Webhook configuration
- Perfect for development
Business Verification Required
- For production use
- Higher conversation limits
- Access to all features
Conversation-Based Pricing
WhatsApp charges per conversation (24-hour window):| Type | Description | Price |
|---|---|---|
| Business-initiated | You message user first | ~$0.005-0.10 per conversation* |
| User-initiated | User messages you first | Free for 24 hours after first message |
| Service conversations | Utility/authentication | Lower rates |
Message Templates
For business-initiated conversations, you must use approved templates.Create Message Template
Access Templates
Create New Template
- Template Name: greeting_new_user (lowercase, underscores only)
- Category: Marketing, Utility, or Authentication
- Languages: Select languages you’ll use
- Template Content: Your message with optional variables
Submit for Approval
Use Approved Templates
Production Checklist
Before going live with WhatsApp API:Business Verification
For production use and higher limits:Start Verification
- Go to Business Settings → Security Center
- Click Start Verification
Provide Business Information
- Business registration certificate
- Business address proof
- Tax documents (varies by country)
- Website or social media presence
Wait for Review
Common Issues & Solutions
Webhook verification failed
Webhook verification failed
- Verify token mismatch
- Webhook URL not accessible
- SSL certificate issues
- Ensure
WHATSAPP_WEBHOOK_VERIFY_TOKENmatches in both places - Test webhook URL accessibility:
curl https://your-domain.com/api/webhook - Verify SSL certificate is valid
Messages not being received
Messages not being received
- Webhook not subscribed to correct fields
- Firewall blocking Meta’s IP ranges
- Backend not processing webhook events
- Check webhook subscriptions include
messagesfield - Whitelist Meta’s webhook IPs
- Check backend logs:
docker-compose logs backend
Access token expired
Access token expired
- Token was set to expire
- Token was revoked
- Generate new token with Never expiration
- Update
WHATSAPP_ACCESS_TOKENin environment - Restart backend:
docker-compose restart backend
Cannot send template messages
Cannot send template messages
- Template not approved
- Template name incorrect
- Variables not matching template
- Verify template status in Meta Business Suite
- Check template name matches exactly (case-sensitive)
- Ensure variable count matches template placeholders
Security Best Practices
-
Never expose access tokens
- Don’t commit to version control
- Use environment variables only
- Rotate tokens periodically
-
Verify webhook signatures
- Validate X-Hub-Signature-256 header
- Reject unsigned requests
-
Use HTTPS only
- Never use HTTP in production
- Ensure valid SSL certificates
-
Monitor API usage
- Set up alerts for unusual activity
- Review access logs regularly
-
Limit access token permissions
- Use minimum required scopes
- Create separate tokens for different services
API Rate Limits
Be aware of WhatsApp API rate limits:| Tier | Messages/Second | Criteria |
|---|---|---|
| Tier 1 | 80 | Default for new businesses |
| Tier 2 | 400 | After 7 days of good messaging |
| Tier 3 | 1,600 | After 14 days of good messaging |
| Tier 4 | 6,400 | After 21 days of good messaging |
Monitoring & Analytics
Track your WhatsApp API usage:Access Analytics
Monitor Key Metrics
- Message volume (sent/received)
- Conversation costs
- Template performance
- Delivery rates
- Quality rating
Set Up Alerts
- High message volumes
- Quality rating drops
- Failed deliveries
- Cost thresholds