Documentation Index
Fetch the complete documentation index at: https://docs.heylua.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
WhatsApp Business API allows your agent to communicate with customers via WhatsApp - the world’s most popular messaging app with 2+ billion users.Business Messaging
Professional customer communication
Rich Media
Images, videos, documents, location
High Engagement
98% open rates
Global Reach
Available in 180+ countries
Prerequisites
Before connecting WhatsApp, you need:Meta Business Account
WhatsApp Business Account (WABA)
Set up in Meta Business Suite
Screenshot: WhatsApp Business Account setup in Meta

Connection Method 1: CLI
Step-by-Step CLI Setup
Configure Webhook in Meta
Open Meta Business Suite
Navigate to WhatsApp → Configuration
Screenshot: WhatsApp Configuration page in Meta

Subscribe to Events
Enable messages and message_status events
Screenshot: Event subscription checkboxes

Connection Method 2: Admin Dashboard
Step-by-Step Dashboard Setup
Open Admin
Enter Credentials
Fill in WhatsApp credentials form
Screenshot: Form with Phone ID, WABA ID, Token fields

Testing Your WhatsApp Channel
Message Status Events
When you send messages via WhatsApp (including template messages), Meta sends status updates back to Lua as messages progress through delivery. Lua captures these events and can forward them to your webhooks.Status Lifecycle
A typical message goes through these statuses:| Status | Meaning |
|---|---|
sent | Message accepted by WhatsApp servers |
delivered | Message delivered to recipient’s device |
read | Recipient opened and read the message |
failed | Message could not be delivered (includes error details) |
played | Recipient played a voice or video message |
Tracking Delivery with Webhooks
To receive these events in your code, subscribe a webhook to the event types you need:Status events are particularly useful when sending template messages via the Templates API. After sending a campaign, subscribe to
message.delivered and message.read to measure engagement, or message.failed to catch delivery issues.Prerequisites
For status events to flow through, make sure you’ve subscribed tomessages and message_status in your Meta webhook configuration (see Configure Webhook in Meta above).
Status & Quality
Connection Status
- 🟢 CONNECTED - Working normally
- 🔴 DISCONNECTED - Needs reconnection
- 🟡 PENDING - Setup in progress
Quality Rating
Meta assigns quality ratings based on user feedback:- 🟢 GREEN - High quality (good!)
- 🟡 YELLOW - Medium quality (watch carefully)
- 🔴 RED - Low quality (take action)
Best Practices
Response Time
Response Time
- Respond within 24 hours
- Quick responses improve quality rating
- Agent handles this automatically
Message Templates
Message Templates
- Use templates for notifications
- Required for messages after 24 hours
- Set up in Meta Business Suite
Opt-In Required
Opt-In Required
- Users must message you first
- Cannot send unsolicited messages
- Respect user privacy
Monitor Quality
Monitor Quality
Troubleshooting
Channel shows DISCONNECTED
Channel shows DISCONNECTED
Causes:
- Token expired
- WABA disabled
- Phone number removed
- Regenerate access token
- Update in admin dashboard
- Verify WABA is active
Messages not delivering
Messages not delivering
Check:
- Quality rating (RED = issues)
- Webhook configured correctly
- Phone number status in Meta
- Message templates approved
Quality rating dropped
Quality rating dropped
Actions:
- Review recent conversations
- Check user feedback in Meta
- Improve agent responses
- Address user complaints
- May need to adjust persona
Next Steps
Facebook Messenger
Connect another channel
Test Your Agent
Test agent behavior
Monitor Channels
View channel analytics
CLI Command Reference
Complete CLI guide













