# Send and Read WhatsApp Messages (Cloud API)

> Lets your AI agent send and read WhatsApp Business messages through Meta's official Cloud API, safely: it checks your number, dry-runs first, respects your recipient allowlist and switches to an approved template when the 24-hour window is closed. Runs on the free, open-source MCP server.

Send and Read WhatsApp Messages (Cloud API) is a free AI agent skill on Agensi by Albert Kweku Ogoe, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Albert Kweku Ogoe](https://www.agensi.io/creators/paakaer)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Version: 1.0
- Last updated: 2026-11-27
- Security: scan passed (2026-11-27); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/send-and-read-whatsapp-messages-cloud-api
- Tags: api, ai-agents, whatsapp-cloud-api, meta-api, messaging-automation, whatsapp, mcp, customer-support

## About this skill

Connecting an AI agent to WhatsApp usually goes wrong in the same few ways: messages silently fail because the 24-hour window has closed, templates get sent with the wrong parameters, or someone gets messaged by mistake. This skill teaches your agent the rules of Meta's official WhatsApp Cloud API so it sends messages that actually arrive, and only to the people you meant.

It works with **whatsapp-cloud-api-mcp**, a free, MIT-licensed, open-source MCP server: one Python file, standard library only, nothing to `pip install`. Where to get it is in the skill's SKILL.md.

### What the agent does with it

- **Checks your number first.** Calls `get_phone_number` once per session and warns you if the quality rating isn't GREEN.
- **Dry-runs before sending.** With `WHATSAPP_DRY_RUN=1` the server returns the exact request instead of sending it; the agent shows it to you and waits for a yes.
- **Respects your allowlist.** Sends to numbers outside `WHATSAPP_ALLOWED_RECIPIENTS` are refused, and the agent reports it instead of trying to widen the list.
- **Picks the right message type.** Free-form text inside the 24-hour window, an `APPROVED` template outside it (or after error `131047`), with `{{1}}…` parameters filled in order.
- **Reads replies.** `list_incoming_messages` returns what the optional webhook receiver stored; the agent marks messages as read only when you've handled them.
- **Explains errors.** Graph API errors come back with a plain-language hint (`131047`, `132001`, `132000`, `131026`, `131030`, `190`), and the agent relays the fix instead of retrying blindly.

### What you need

- A Meta developer app with the WhatsApp product (Meta gives you a free test number).
- The `whatsapp-cloud-api-mcp` server added to your agent, with your token and phone number ID in its environment. The agent never asks for the token in chat.
- Optional: `webhook.py` running behind HTTPS if you want to read replies.

### Good for

- Answering customer questions on WhatsApp from your agent.
- Sending order, booking or reminder updates with approved templates.
- Checking which templates are approved and what parameters they take.

### Limits

- Meta bills template messages per conversation category and country; the agent tells you before using one.
- Replies are only visible while the webhook receiver is running.
- This skill is for one-to-one messaging, not bulk broadcasts.

## Requires

- whatsapp-cloud-api-mcp server (free, open source)
- WhatsApp
- Python 3.9+
- Optional: Public HTTPS URL for the webhook (only to read replies)

Your Meta access token goes in the MCP server's environment, never in chat. Meta's free test number is enough to try it.

## Known limitations

Needs the whatsapp-cloud-api-mcp server added to your agent. Replies are only visible while the optional webhook.py is running. Meta bills template messages. Built for one-to-one messaging, not bulk broadcasts.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Send and Read WhatsApp Messages (Cloud API) skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill stop my WhatsApp messages from failing?

It makes the agent pick the right message type: free-form text only within 24 hours of the customer's last message, an approved template otherwise. If Meta still refuses a message, the server returns the error with a plain-language hint (for example 131047: use a template), and the agent follows it instead of retrying blindly.

### What do I need to set up first?

A Meta developer app with the WhatsApp product (Meta's free test number works), and the open-source whatsapp-cloud-api-mcp server added to your agent with your access token and phone number ID in its environment. To read replies, also run the included webhook.py behind an HTTPS URL.

### Can I test it without messaging real customers?

Yes. Start the server with WHATSAPP_DRY_RUN=1 and every send returns the exact request instead of sending it. You can also set WHATSAPP_ALLOWED_RECIPIENTS so the server refuses any number that isn't on your list.

### Does it answer customer replies on its own?

No. It doesn't run in the background. When you ask, your agent reads the replies the webhook saved and drafts or sends responses. It marks a message as read only once you've handled it.

### Why does it check my number's quality rating?

Meta rates every sending number GREEN, YELLOW or RED based on how recipients react, and a low rating can limit how many people you can message. The agent checks it at the start of a session and warns you before sending if it isn't GREEN.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
