Prerequisites
This cookbook demonstrates how to use WhatsApp integration with Agno. Before running this example, you'''ll need to complete these setup steps:- 
Create Meta Developer Account
- Go to Meta Developer Portal and create a new account
 - Create a new app at Meta Apps Dashboard
 - Enable WhatsApp integration for your app here
 
 - Set Up WhatsApp Business API You can get your WhatsApp Business Account ID from Business Settings
 - 
Configure Environment
- Set these environment variables:
 
 - Set these environment variables:
 
- For first-time outreach, you must use pre-approved message templates here
 - Test messages can only be sent to numbers that are registered in your test environment
 
Example
The following agent will send a template message using WhatsApp:cookbook/tools/whatsapp_tool.py
Toolkit Params
| Parameter | Type | Default | Description | 
|---|---|---|---|
access_token | Optional[str] | None | WhatsApp Business API access token. If not provided, uses WHATSAPP_ACCESS_TOKEN environment variable. | 
phone_number_id | Optional[str] | None | WhatsApp Business Account phone number ID. If not provided, uses WHATSAPP_PHONE_NUMBER_ID environment variable. | 
version | str | "v22.0" | API version to use. If not provided, uses WHATSAPP_VERSION environment variable or defaults to “v22.0”. | 
recipient_waid | Optional[str] | None | Default recipient WhatsApp ID (e.g., “1234567890”). If not provided, uses WHATSAPP_RECIPIENT_WAID environment variable. | 
async_mode | bool | False | Enable asynchronous methods for sending messages. | 
Toolkit Functions
| Function | Description | 
|---|---|
send_text_message_sync | Sends a text message to a WhatsApp user (synchronous). Parameters: text (str), recipient (Optional[str]), preview_url (bool), recipient_type (str). | 
send_template_message_sync | Sends a template message to a WhatsApp user (synchronous). Parameters: recipient (Optional[str]), template_name (str), language_code (str), components (Optional[List[Dict[str, Any]]]). | 
send_text_message_async | Sends a text message to a WhatsApp user (asynchronous). Parameters: text (str), recipient (Optional[str]), preview_url (bool), recipient_type (str). | 
send_template_message_async | Sends a template message to a WhatsApp user (asynchronous). Parameters: recipient (Optional[str]), template_name (str), language_code (str), components (Optional[List[Dict[str, Any]]]). |