| id | ailey-com-whatsapp |
| name | WhatsApp Business Integration |
| description | Comprehensive WhatsApp Business API integration with account tier detection, message automation, media handling, and webhook support. Supports Cloud (Standard/Business) and on-premises (Enterprise) deployments with automatic tier detection and feature availability mapping. |
| keywords | ["whatsapp","messaging","business","automation","api","integration","webhook","templates","media"] |
| tools | ["axios","commander","dotenv"] |
WhatsApp Business Integration
Overview
Complete WhatsApp Business API integration for AI-ley enabling two-way messaging, message automation, template management, media handling, and webhook-based event processing. Automatically detects account tier (Cloud Standard/Business or Enterprise) and maps available features accordingly.
Setup Time: 15-30 minutes
Difficulty: Intermediate
API Rate: 1 message/second (Standard), 60 messages/second (Business), unlimited (Enterprise)
Pricing: $0.005-$0.01 per incoming message (Cloud), custom (Enterprise)
Account Tier Detection
Tier 1: Cloud Standard
When: Free API key with basic messaging
Features:
- ✅ Text message sending/receiving
- ✅ Media messages (limited)
- ✅ Template messages (20 limit)
- ✅ Webhook events
- ✅ Basic contact management
- ✅ Manual phone verification
- ❌ Advanced templates
- ❌ Team collaboration
- ❌ Advanced analytics
Contact Limit: Unlimited
Cost: $0.005 per incoming message, free outgoing templates
Setup: developers.facebook.com
Use Case: Testing, low-volume, MVP
Tier 2: Cloud Business
When: Business API with enhanced capabilities
Features:
- ✅ All Standard features
- ✅ Unlimited message templates
- ✅ Advanced contact segmentation
- ✅ Scheduled messaging
- ✅ Team collaboration (up to 10 users)
- ✅ Detailed analytics dashboard
- ✅ Message templates library
- ✅ Automated workflows
- ❌ On-premises deployment
- ❌ Dedicated infrastructure
- ❌ Custom compliance
Contact Limit: Unlimited
Cost: $0.01 per incoming message, tiered template pricing
Setup: Business Dashboard
Use Case: Growing business, marketing automation
Tier 3: Enterprise (On-Premises/Dedicated)
When: Custom deployment, high volume, compliance requirements
Features:
- ✅ All Business features
- ✅ Dedicated infrastructure
- ✅ Custom deployment options
- ✅ Advanced security & compliance
- ✅ Multi-region support
- ✅ Dedicated support team
- ✅ Custom integrations
- ✅ SLA guarantee
- ✅ Unlimited API rate
- ✅ White-label options
Contact Limit: Unlimited
Cost: Custom pricing
Setup: Enterprise sales team
Use Case: Enterprise, regulated industries, high volume
Feature Availability Matrix
| Feature | Standard | Business | Enterprise |
|---|
| Text Messages | ✅ | ✅ | ✅ |
| Media Messages | ✅ | ✅ | ✅ |
| Templates | 20 limit | Unlimited | Unlimited |
| Webhooks | ✅ | ✅ | ✅ |
| Contact Management | Basic | Advanced | Advanced+ |
| Scheduling | ❌ | ✅ | ✅ |
| Team Collaboration | ❌ | ✅ | ✅ |
| Analytics | Basic | Advanced | Advanced+ |
| Rate Limit | 1 msg/sec | 60 msg/sec | Unlimited |
| On-Premises | ❌ | ❌ | ✅ |
| Dedicated Support | ❌ | ✅ | ✅ |
| Custom Compliance | ❌ | ❌ | ✅ |
| Multi-Region | ❌ | ❌ | ✅ |
Installation
cd .github/skills/ailey-com-whatsapp
npm install
npm run build
Setup Instructions
Step 1: Get API Credentials
For Cloud API (Standard/Business):
- Visit developers.facebook.com
- Log in or create a developer account
- Create a new app:
- Click "Create App"
- Choose "Business" type
- Fill in app name and contact email
- Create app
- Add WhatsApp product:
- Dashboard → "Add Product"
- Search for "WhatsApp"
- Click "Set Up"
- Choose "Cloud API"
- Get credentials:
- Go to "API Setup" section
- Copy your Phone Number ID
- Copy your Business Account ID
- Click "Create System User"
- Create token and copy (keep secure!)
For Enterprise (On-Premises):
- Contact WhatsApp Enterprise sales: WhatsApp Enterprise
- Request on-premises deployment
- Follow enterprise setup guide
- Configure API endpoints and credentials
Step 2: Verify Phone Number
- In Cloud Dashboard, go to "Phone Numbers"
- Click "Add Phone Number"
- Choose phone number type (business)
- Enter your business phone number (with country code)
- Verify via SMS or phone call
- Confirm verification
- Copy Phone Number ID
Step 3: Configure Environment
cp .env.example .env
WHATSAPP_API_TOKEN=your_bearer_token_from_dashboard
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id_from_dashboard
WHATSAPP_BUSINESS_ACCOUNT_ID=your_waba_id_from_settings
WHATSAPP_ENVIRONMENT=cloud
Finding Your Credentials:
| Credential | Location | Format |
|---|
| API Token | Dashboard → API Setup → System User Token | Bearer token (long string) |
| Phone Number ID | Dashboard → Phone Numbers → Your Number | 15-20 digit number |
| Business Account ID | Dashboard → Settings → Business Account ID | 15-20 digit number |
Step 4: Verify Setup
npm run detect
npm run auth -- verify
npm run diagnose
Step 5: Configure Webhook (Optional)
For receiving messages and status updates:
npm run webhook -- setup \
--url "https://your-domain.com/webhook" \
--verify-token "generate_secure_token_here"
npm run webhook -- events \
--enable "message_received,message_delivered,message_read,message_failed"
Quick Start
Send Text Message
npm run send -- \
--phone "15551234567" \
--message "Hello from WhatsApp!"
Send Template Message
npm run message -- template \
--phone "15551234567" \
--template "hello_world" \
--language "en_US"
Send Media Message
npm run media -- send \
--phone "15551234567" \
--type "image" \
--url "https://example.com/image.jpg" \
--caption "Check this out!"
Manage Contacts
npm run contact -- add \
--phone "15551234567" \
--first-name "John" \
--last-name "Doe"
npm run contact -- list
Configure Business Profile
npm run business -- profile \
--name "My Store" \
--category "ECOMMERCE" \
--description "Welcome to my store!"
npm run business -- hours \
--open "09:00" \
--close "17:00" \
--timezone "UTC"
API Reference
Message Types
Text Message
npm run send -- \
--phone "15551234567" \
--message "Your message here"
Template Message
npm run message -- template \
--phone "15551234567" \
--template "template_name" \
--language "en_US" \
--parameters '["param1", "param2"]'
Media Message
npm run media -- send \
--phone "15551234567" \
--type "image|video|audio|document" \
--url "https://..." \
--caption "Optional caption"
Contact Management
npm run contact -- add \
--phone "15551234567" \
--first-name "John" \
--last-name "Doe"
npm run contact -- get --phone "15551234567"
npm run contact -- update \
--phone "15551234567" \
--first-name "Jane"
npm run contact -- remove --phone "15551234567"
npm run contact -- list
TypeScript Integration
import { createWhatsAppClient } from '@ailey/com-whatsapp';
const client = createWhatsAppClient();
const account = await client.detectAccountTier();
console.log(`Tier: ${account.tier}`);
console.log(`Features: ${account.features.join(', ')}`);
const msg = await client.sendTextMessage({
recipientPhone: '15551234567',
body: 'Hello!'
});
const template = await client.sendTemplateMessage({
recipientPhone: '15551234567',
templateName: 'order_update',
language: 'en_US',
parameters: ['ORDER123', 'Shipped']
});
const media = await client.sendMediaMessage({
recipientPhone: '15551234567',
type: 'image',
url: 'https://example.com/image.jpg',
caption: 'Check this out!'
});
client.on('message_received', (message) => {
console.log(`New message from ${message.from}: ${message.text}`);
});
client.on('message_delivered', (status) => {
console.log(`Message ${status.messageId} delivered`);
});
Workflows
Workflow 1: Order Confirmation with Media
npm run message -- template \
--phone "15551234567" \
--template "order_confirmation" \
--language "en_US" \
--parameters '["ORDER123", "Jane Doe"]'
npm run media -- send \
--phone "15551234567" \
--type "document" \
--url "https://example.com/invoice.pdf" \
--caption "Your invoice"
Workflow 2: Customer Support Automation
npm run send -- \
--phone "15551234567" \
--message "Thanks for contacting us. We'll respond within 2 hours."
npm run media -- send \
--phone "15551234567" \
--type "document" \
--url "https://help.example.com/faq.pdf" \
--caption "FAQ: Common questions and answers"
Workflow 3: Marketing Campaign
npm run contact -- add \
--phone "15551111111" \
--first-name "Alice"
npm run contact -- add \
--phone "15552222222" \
--first-name "Bob"
npm run message -- template \
--phone "15551111111" \
--template "weekly_promo" \
--language "en_US" \
--parameters '["50% OFF"]'
Error Handling
Common Errors
| Error | Cause | Solution |
|---|
| Invalid API Token | Expired or incorrect token | Regenerate at Dashboard → API Setup |
| Phone Not Verified | Number not confirmed | Complete verification in Dashboard |
| Rate Limit Exceeded | Too many messages sent | Wait 1 minute or upgrade tier |
| Template Not Found | Template doesn't exist | Create template in Dashboard |
| Invalid Phone Format | Wrong number format | Use +{country_code}{number} |
Troubleshooting
Connection Issues
npm run auth -- verify
npm run auth -- test
npm run diagnose
Message Not Sending
npm run send -- \
--phone "+15551234567" \
--message "Test"
npm run contact -- get --phone "+15551234567"
npm run message -- template --list
Webhook Not Receiving
npm run webhook -- setup --url "https://your-domain.com/webhook" --verify-token "token"
npm run webhook -- events --enable "message_received"
AI-ley Configuration
Add to .github/aicc/aicc.yaml:
integrations:
whatsapp:
enabled: true
apiToken: ${WHATSAPP_API_TOKEN}
phoneNumberId: ${WHATSAPP_PHONE_NUMBER_ID}
businessAccountId: ${WHATSAPP_BUSINESS_ACCOUNT_ID}
accountTier: auto
environment: cloud
webhookToken: ${WHATSAPP_WEBHOOK_TOKEN}
webhookUrl: ${WHATSAPP_WEBHOOK_URL}
rateLimit: 60
features:
- text_messaging
- media_messaging
- template_messages
- contact_management
- webhook_events
- business_profile
- message_templates
- automation
Resources
Support
For issues:
- Run
npm run diagnose for diagnostics
- Check WhatsApp Developers Documentation
- Review API Error Codes
- Contact WhatsApp Support through your dashboard
version: 1.0.0
updated: 2026-02-01
reviewed: 2026-02-01
score: 4.8