Documentation Index
Fetch the complete documentation index at: https://docs-v1.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
Code
cookbook/tools/whatsapp_tools.py
from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.whatsapp import WhatsAppTools
agent = Agent(
name="whatsapp",
model=Gemini(id="gemini-2.0-flash"),
tools=[WhatsAppTools()],
)
# Example: Send a template message
# Note: Replace '''hello_world''' with your actual template name
agent.print_response(
"Send a template message using the '''hello_world''' template in English to +91 1234567890"
)
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set up WhatsApp Business API
- Go to Meta for Developers
- Create a Meta App and set up the WhatsApp Business API.
- Obtain your Phone Number ID and a permanent System User Access Token.
Set your API keys and identifiers
export WHATSAPP_ACCESS_TOKEN=xxx
export WHATSAPP_PHONE_NUMBER_ID=xxx
export OPENAI_API_KEY=xxx # Or your preferred LLM API key
Install libraries
pip install -U agno openai google-generativeai # Add any other necessary WhatsApp SDKs
Run Agent
python cookbook/tools/whatsapp_tools.py