Code
cookbook/tools/whatsapp_tools.py
Usage
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.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
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"
)
Create a virtual environment
Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set up WhatsApp Business API
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
Was this page helpful?