WhatsApp AI Agent
A core PHP & MySQLi backend connecting Meta Cloud API to OpenRouter's advanced models with human override takeovers.
Webhook Callback URL
Use this URL inside the Facebook Developer Webhooks config. Note: For localhost, use a tunnel tool like ngrok or your public local IP address.
Setup & Configuration Guide
Set API Credentials
Open includes/functions.php and substitute placeholder keys:
WHATSAPP_TOKEN: Permanent WhatsApp system user token.PHONE_NUMBER_ID: Meta phone identification string.VERIFY_TOKEN: Custom token for Meta webhook confirmation.OPENROUTER_API_KEY: OpenRouter API authorization key.
Meta Developer Portal Configuration
Log into Meta Developers Dashboard and configure your application:
- Set Webhook URL: Paste the Callback URL (use local IP or ngrok tunnel).
- Set Verify Token: Must match your defined
VERIFY_TOKEN. - Subscribe to Webhook Fields: Select messages.
Run & Monitor Control Center
Once configured, open the **Control Center Dashboard**. Standard messages will auto-reply using OpenRouter completions. Typing a reply manually switches the chat into **Human Mode**, pausing the AI helper instantly. Flipped switches toggle mode settings manually.