WhatsApp Business API Integration
Connect your AI agents to WhatsApp using Meta's official Cloud API. This is the recommended approach for production WhatsApp integrations.
Overview
WhatsApp Business API allows you to: - Send and receive messages programmatically - Connect to your AI agents for automated responses - Handle high message volumes reliably - Use official, supported APIs
Prerequisites
Before connecting WhatsApp Business to NeuroGen, you'll need:
- Meta Business Account - Create one at business.facebook.com
- WhatsApp Business App - Created in Meta Developer Portal
- Verified Business - For production use (test mode available for development)
- Phone Number - A phone number to use with WhatsApp Business
Step-by-Step Setup
Step 1: Create Meta Business Account
- Go to business.facebook.com
- Click "Create Account"
- Follow the prompts to set up your business account
- Complete business verification (required for production)
Step 2: Create WhatsApp Business App
- Go to Meta Developer Portal
- Click "Create App"
- Select "Business" as the app type
- Choose "WhatsApp" as the use case
- Name your app and click "Create App"
Step 3: Set Up WhatsApp API
- In your app dashboard, find WhatsApp in the left sidebar
- Click API Setup
- You'll see your Phone Number ID - copy this
- Click Generate to create an access token
- For testing: Use the temporary token (expires in 24 hours)
- For production: Create a System User and permanent token
Step 4: Create Permanent Access Token (Recommended)
- Go to Business Settings
- Navigate to Users → System Users
- Click Add to create a new system user
- Assign the Admin role
- Click Generate New Token
- Select your WhatsApp app
- Add these permissions:
whatsapp_business_managementwhatsapp_business_messaging- Click Generate Token and copy it safely
Step 5: Connect to NeuroGen
- Go to Dashboard → Integrations
- Click WhatsApp
- Enter your Phone Number ID
- Paste your Access Token
- Optionally enter your App Secret (for webhook security)
- Select an Agent to handle messages
- Click Connect WhatsApp Business
Step 6: Configure Webhook
After connecting, you'll receive:
- Webhook URL: https://neurogen.cc/api/whatsapp-business/webhook/{your-connection-id}
- Verify Token: A unique token for verification
Configure this in Meta Developer Portal:
- Go to your WhatsApp app
- Navigate to WhatsApp → Configuration
- Click Edit under Webhooks
- Enter the webhook URL
- Enter the verify token
- Subscribe to messages field
- Click Verify and Save
How Messages Work
Incoming Messages
When someone sends a message to your WhatsApp Business number:
- Meta sends a webhook to NeuroGen
- NeuroGen processes the message through your AI agent
- The response is sent back to the user
Outgoing Messages
Within 24-Hour Window: - After a user messages you, you have 24 hours to respond with any message - No template required during this window
After 24 Hours: - You must use an approved message template - Templates must be pre-approved by Meta - This prevents spam
Message Templates
For initiating conversations or messaging after 24 hours:
- Go to WhatsApp Manager in Meta Business Suite
- Navigate to Account Tools → Message Templates
- Create and submit templates for approval
- Once approved, use them in your responses
Rate Limits
WhatsApp Business API has rate limits based on your tier:
| Tier | Messages/Day | Requirements |
|---|---|---|
| Unverified | 250 | Test numbers only |
| Tier 1 | 1,000 | Verified business |
| Tier 2 | 10,000 | Good quality rating |
| Tier 3 | 100,000 | Consistent high quality |
| Tier 4 | Unlimited | Enterprise agreement |
Quality Rating
Meta monitors your message quality:
- Green: High quality, good engagement
- Yellow: Medium quality, some issues
- Red: Low quality, restrictions may apply
Tips for maintaining quality: - Only message users who have opted in - Respond promptly (within 24 hours) - Don't send spam or promotional messages - Use templates appropriately
Testing
Test Phone Numbers
Meta provides test phone numbers in the developer dashboard:
- Go to WhatsApp → API Setup
- Under Send and receive messages, add your phone number
- Verify with SMS code
- You can now send test messages
Test Message
Send a test message from the NeuroGen integrations page:
- Go to Integrations
- Find your WhatsApp connection
- Click Test (if available)
- Enter a phone number and message
Troubleshooting
Invalid Access Token
- Ensure you're using the full token
- Check if the token has expired
- Verify the token has correct permissions
Webhook Not Receiving Messages
- Verify the webhook URL is correct
- Check the verify token matches
- Ensure you've subscribed to the
messagesfield - Check that your server is accessible from the internet
Message Not Sending
- Verify the recipient phone number format (country code, no +)
- Check if you're within the 24-hour window or using a template
- Verify your business is approved for messaging
Rate Limited
- Wait for the limit to reset
- Apply to increase your messaging tier
- Improve your quality rating
Security Best Practices
- Use App Secret: Configure app secret for webhook signature verification
- Protect Access Token: Never expose your access token in client-side code
- Validate Webhooks: Always verify webhook signatures
- Use HTTPS: All communication uses HTTPS by default
Pricing
WhatsApp Business API pricing: - Business-initiated messages: Per-message fee (varies by country) - User-initiated messages: First 1,000/month free, then per-message
Check Meta's pricing page for current rates.
Resources
- WhatsApp Business API Documentation
- Message Template Guidelines
- Webhook Setup Guide
- Meta Business Help Center
Support
Need help with WhatsApp Business integration?
- Check the Meta Developer Support
- Contact support@neurogen.cc for NeuroGen-specific issues