Skip to main content
agent_with_media.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Expose the server

Start ngrok for port 7777 and copy its public HTTPS URL. Keep ngrok running:
5

Start AgentOS

Save the code above as agent_with_media.py, then run:
Keep the server running while you configure and verify the webhook.
6

Configure the webhook

Follow WhatsApp setup. In Meta, set the callback URL to https://<your-ngrok-url>/whatsapp/webhook, use the same verify token as WHATSAPP_VERIFY_TOKEN, and subscribe to the messages field. Verify the webhook while AgentOS and ngrok are running.
Full source: cookbook/05_agent_os/19_whatsapp/media.py