Skip to main content

Prerequisites

  1. Go to the Meta Developer Portal and create a developer account.
  2. Create a new Business app at the Apps Dashboard.
  3. Add the WhatsApp product to your app from the app dashboard.
  4. In WhatsApp > API Setup, note your Phone Number ID and generate an Access Token.
export WHATSAPP_ACCESS_TOKEN=your_access_token
export WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
export WHATSAPP_RECIPIENT_WAID=recipient_phone_number   # e.g. 1234567890
For first-time outreach to a user, you must use pre-approved message templates. Test messages can only be sent to numbers registered in your test environment.

Example

The following agent sends a template message via WhatsApp:
cookbook/91_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-3-flash-preview"),
    tools=[WhatsAppTools()],
)

agent.print_response(
    "Send a template message using the 'hello_world' template in English to +1 1234567890"
)

Run the Example

pip install agno google-generativeai
python whatsapp_tools.py
For more examples, see the WhatsApp cookbooks.