← All writing

Your Own AI Assistant Inside WhatsApp, in 10 Minutes

· Muaaz Ahmad

Most people already have an AI assistant. It lives in a separate app they forget to open.

WhatsApp is the app nobody forgets to open. Meta published the developer manual and terms for a new feature on August 25, 2026, and has been rolling it out since. It lets you connect your own AI agent to it: a private chat, in your normal chat list, that runs whatever brain and instructions you choose.

I built one, tested it on my phone, and published the template. This post covers three things: what the feature actually is, what it's good for, and how to set yours up with a free key.

What Meta actually shipped

In WhatsApp, under Settings → Agents, you can create an agent: give it a name and a photo, and WhatsApp opens a chat with it and gives you an API key. Paste that key into a program running somewhere (your laptop is fine) and that program becomes the agent's brain.

Creating an agent in WhatsApp: name and emoji avatar, then Add

The new agent's chat with the View API key button

The rules, straight from Meta's terms and developer manual:

  • Up to 5 agents per WhatsApp account.
  • Only you can talk to it. An agent can message only the account that created it. No groups, no other people, not even your other agents.
  • It can only see what you send it. Not your other chats, contacts or gallery.
  • Not end-to-end encrypted. Messages pass through a Meta service and reach whichever AI company you connect. Your normal chats stay end-to-end encrypted; this chat is different.
  • Free from WhatsApp's side for now. You pay only for the AI you plug in, and Gemini has a free tier.
  • Limited rollout. It's in select countries and beta builds first, so you may not see it yet even if a friend does.

Takeaway: treat it as a private assistant for you, not a customer-service bot. For talking to customers, the WhatsApp Business API is still the tool.

What a personal agent is good for

The best uses are the ones where WhatsApp is already where the thing happens. Here's what my template does out of the box:

You sendBob does
A photo of a bill, form or medicine boxExplains it in plain words: what it is, what to do, by when
A photo of a menu or sign in another languageTranslates and explains it
"Remind me to call mom at 6"Confirms, then messages you first at 6
A voice note in Urdu or ArabicReplies in the same language (Gemini brain)
A PDFSummarises it (Gemini or Claude brain)
/resetForgets the conversation and starts fresh

Here's what it looked like on my phone. I named the test agent Bob.

Photo of a book sent to the agent; it replies with the title and author

A voice note asking about OpenAI vs Claude, and the agent's written answer

Two minutes after asking, the agent sends a reminder on its own

That reminder is the important one. A normal chatbot only answers. An agent can start the conversation: a reminder, a daily summary, a nudge. That's the difference between a tool you visit and an assistant that shows up.

And because the personality lives in one plain-English file, the same template becomes something else in minutes:

  • "You're a patient maths tutor for my 12-year-old. Give hints, never the answer straight away."
  • "You're my fitness coach. I train three days a week. Ask how today's session went."
  • "You help me run my bakery. Our prices are..."

Takeaway: pick one job that already happens in WhatsApp for you, and write it down as three or four sentences. That's your prompt.

Set yours up in 10 minutes

You need: WhatsApp with the Agents option, a Windows or Mac computer with Python, and one AI key.

Choose a brain

BrainCostDefault model in the templateGood at
Google GeminiFree tiergemini-3.5-flash-litePhotos, PDFs and voice notes
Claude (Anthropic)Pay per useclaude-haiku-5-5Photos, PDFs, careful writing
OpenAIPay per usegpt-6-lunaPhotos, low cost

No key yet? Start with Gemini: get one free at aistudio.google.com/apikey.

The steps

  1. Create the agent. WhatsApp → Settings → Agents → Create. Name it, add a photo, then tap View API key in its chat and copy the key. Treat it like a password: whoever has it controls your agent.
  2. Download the template. Go to github.com/muaazdev/whatsapp-agent → green Code button → Download ZIP → unzip it.
  3. Add your keys. Double-click start.bat (Mac: sh start.sh). It creates a file called .env and opens it. Paste:
WHATSAPP_AGENT_KEY=the-key-from-whatsapp
AI_PROVIDER=gemini
GEMINI_API_KEY=your-free-gemini-key
UTC_OFFSET_HOURS=3
  1. Make it yours. Open prompt.md and rewrite who your assistant is, in plain English.
  2. Start it. Double-click start.bat again. When it says it's running, say hi to your agent in WhatsApp.

It answers while that window is open. Close it and the agent goes quiet. Messages you send while it's off wait for it (Meta keeps them for 30 days), so nothing is lost.

Takeaway: the whole setup is two files: prompt.md for who it is and .env for keys. You never touch the code.

Under the hood (for engineers)

How it works: you message the agent in WhatsApp, Meta's Agent Platform holds the message, agent.py on your computer polls for it, asks the AI brain using prompt.md, and sends the reply back the same way.

If you build agents for a living, the protocol is refreshingly small. Base URL https://api.whatsapp.com/agent/v1, auth is Authorization: Bearer <agent key>, and there are four endpoints that matter:

EndpointPurpose
GET /updates?offset=&timeout=25Long-poll for messages and receipts
POST /messagesSend text or media (to the creator only)
POST /statusesBlue ticks, plus an optional typing indicator
GET /media/{id}Metadata + URL to download what the user sent

The design choices that shape everything:

  • No webhooks. Long polling only. The agent holds a request open for up to 25 seconds. So it needs no public URL, TLS cert or tunnel. It runs behind any firewall with outbound HTTPS. This is why a laptop is a valid deployment target.
  • One poller per key. Start a second process and the first gets HTTP 409. In development, create a second agent rather than sharing a key.
  • Offsets are yours to keep. Each response returns next_offset; a 204 (nothing new) doesn't, so you re-poll with the same one. Polling doesn't consume messages, but marking read does, so mark after you've handled a message if you care about replay after a crash.
  • Tight rate limits. 12 sends, 12 status updates and 15 polls per minute per agent, and text tops out at 4,096 characters. No message edits, so token streaming is out: send one complete reply.
  • Proactive sends are allowed, to the creator. That's what makes scheduled reminders possible without any template-message approval flow.

How the template stays at one file (~350 lines, only dependency requests):

  • One loop does everything: check due reminders → long-poll → handle messages → save the offset.
  • Three brains behind one function. Gemini, Claude and OpenAI each get a ~20-line adapter that turns "text + optional image/PDF/audio bytes" into that provider's request shape.
  • Reminders without a scheduler. The system prompt asks the model to append one hidden line, REMIND: YYYY-MM-DD HH:MM | text, when the user asks for a reminder. The code strips it from the reply, stores it in data/reminders.json, and the loop sends it when it's due. Because a poll returns at least every 25 seconds, reminders land within about half a minute.
  • State is three JSON files: offset + creator id, the last 20 turns of history, and pending reminders.
  • Tested offline. tests/test_agent.py fakes Meta's API and all three AI providers, then asserts the exact requests: read receipt with typing indicator, quoted reply, hidden reminder line stripped, reminder delivered, offset persisted.

Takeaway (copy this pre-ship checklist):

  • One process per key; exit loudly on 409
  • Persist next_offset; don't advance it on 204
  • Mark read before the slow model call only if you accept losing that message on a crash
  • Chunk replies under 4,096 chars and pace sends under 12/min
  • Tell users plainly that this chat isn't end-to-end encrypted

Where it stops

Be honest with yourself and anyone you share this with:

  • It's personal. One person, one chat. For customers, use the WhatsApp Business API.
  • It needs a running computer. For 24/7, run it on a small always-on machine instead of a laptop.
  • Privacy is different here. Don't send passwords, ID scans or anything you wouldn't put in an email.
  • AI can be wrong. For health, money or legal answers, it should point you to a professional, and the default prompt tells it to.

Try it this week

Pick one annoying thing you already do in WhatsApp: forwarding bills to yourself, translating messages, remembering calls. Write three sentences about how you'd want an assistant to handle it. Paste them into prompt.md. That's your first agent.

Template: github.com/muaazdev/whatsapp-agent

Sources

Originally published on Substack.

Newsletter

Get the next post by email

Production AI engineering, three times a week. Free, on Substack.

Need this built for real?

I take systems like this into production. Email me or download the CV.