Use the WhatsApp interface to serve Agents or Teams via WhatsApp. It mounts webhook routes on a FastAPI app and sends responses back to WhatsApp users and threads.Documentation Index
Fetch the complete documentation index at: https://agno-v2-shaloo-ai-support-link.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Setup
Set up your WhatsApp Business API and configure the webhook URL to point to your AgentOS instance. Required environment variables:WHATSAPP_ACCESS_TOKENWHATSAPP_PHONE_NUMBER_IDWHATSAPP_VERIFY_TOKEN- Optional (production):
WHATSAPP_APP_SECRETandAPP_ENV=production
The user’s phone number is automatically used as the
user_id for runs. This ensures that sessions and memory are appropriately scoped to the user.The phone number is also used for the session_id, so a single WhatsApp conversation corresponds to a single session. This should be considered when managing session history.Example Usage
Create an agent, expose it with theWhatsapp interface, and serve via AgentOS:
Core Components
Whatsapp(interface): Wraps an AgnoAgentorTeamfor WhatsApp via FastAPI.AgentOS.serve: Serves the FastAPI app using Uvicorn.
Whatsapp Interface
Main entry point for Agno WhatsApp applications.
Initialization Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
agent | Optional[Agent] | None | Agno Agent instance. |
team | Optional[Team] | None | Agno Team instance. |
agent or team.
Key Method
| Method | Parameters | Return Type | Description |
|---|---|---|---|
get_router | use_async: bool = True | APIRouter | Returns the FastAPI router and attaches endpoints. |
Endpoints
Mounted under the/whatsapp prefix:
GET /whatsapp/status
- Health/status of the interface.
GET /whatsapp/webhook
- Verifies WhatsApp webhook (
hub.challenge). - Returns
hub.challengeon success;403on token mismatch;500ifWHATSAPP_VERIFY_TOKENmissing.
POST /whatsapp/webhook
- Receives WhatsApp messages and events.
- Validates signature (
X-Hub-Signature-256); bypassed in development mode. - Processes text, image, video, audio, and document messages via the agent/team.
- Sends replies (splits long messages; uploads and sends generated images).
- Responses:
200 {"status": "processing"}or{"status": "ignored"},403invalid signature,500errors.