Download the PHP package telmodev/cloud-api-whatsapp without Composer
On this page you can find all versions of the php package telmodev/cloud-api-whatsapp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cloud-api-whatsapp
Laravel WhatsApp Cloud API Client
A simple, clean, and elegant Laravel package to interact with the Meta WhatsApp Cloud API.
Features
- ⚡️ Seamless integration with Laravel's HTTP Client (
Http::) and facades - 📱 Dynamic configuration — swap token or phone number ID on the fly (multi-tenant support)
- ✉️ Text messages, template messages, replies, and emoji reactions
- 🔘 Interactive messages — reply buttons and list menus
- 🖼️ Media — images, videos, audio, documents, stickers (upload, send, delete)
- 📍 Location sharing and contact cards
- 🏢 Business Profile management (read and update)
- 📋 Template management — list, create, and delete message templates
- 🔔 Webhook handling — challenge verification and HMAC-SHA256 signature validation
- 🧪 Fully testable with Laravel's HTTP mocking
Requirements
- PHP 8.2 or higher
- Laravel 10, 11, or 12
Installation
Install the package via Composer:
The Service Provider and Facade are registered automatically via Laravel's package auto-discovery. No manual changes to config/app.php are needed.
Publish the configuration file
This creates config/cloud-api-whatsapp.php in your project with all available options.
Publish the AI agent skill
The package ships the SDK documentation as an Agent Skill (open SKILL.md standard), so AI coding assistants (Claude Code, opencode, Codex, ChatGPT, Cursor, Gemini CLI, Antigravity, etc.) can implement the SDK correctly without browsing the source.
Install it for your provider:
Each tag copies the skill into the provider's skill directory in your project:
| Tag | Installed to | Providers that read it |
|---|---|---|
...-claude |
.claude/skills/cloud-api-whatsapp/ |
Claude Code |
...-opencode |
.opencode/skills/cloud-api-whatsapp/ |
opencode |
...-codex |
.agents/skills/cloud-api-whatsapp/ |
OpenAI Codex |
...-chatgpt |
.agents/skills/cloud-api-whatsapp/ |
ChatGPT |
...-cursor |
.cursor/skills/cloud-api-whatsapp/ |
Cursor |
...-gemini |
.gemini/skills/cloud-api-whatsapp/ |
Gemini CLI |
...-antigravity |
.agents/skills/cloud-api-whatsapp/ |
Google Antigravity |
cloud-api-whatsapp-agents (combined) |
.agents/skills/cloud-api-whatsapp/ |
opencode, Codex, ChatGPT, Cursor, Gemini CLI, Antigravity |
The combined tag installs to the shared .agents/skills/ location that most tools read. Claude Code does not read .agents/skills — use cloud-api-whatsapp-agents-claude if you use Claude Code.
Configuration
Add these variables to your .env file:
WHATSAPP_BUSINESS_ACCOUNT_ID is required for template management endpoints. All other template and messaging endpoints only need WHATSAPP_PHONE_NUMBER_ID.
Usage
All examples use the CloudApiWhatsapp facade. You can also resolve the class via dependency injection.
Text Messages
Reply to a Message
Quote a previous message in the conversation thread.
Emoji Reactions
React to a received message. Pass an empty string to remove an existing reaction.
Template Messages
Required for business-initiated conversations (outside the 24-hour customer window).
Interactive Messages
Reply Buttons (up to 3)
List Menu
Media
You can send media using a public URL or a Meta Media ID obtained after uploading.
Images
Documents
Video
Audio
Stickers
Stickers must be in .webp format.
Upload, retrieve, and delete media
Location
Contacts
Mark as Read
Raw Payload
For advanced use cases not covered by a dedicated method:
Business Profile
Template Management
Requires WHATSAPP_BUSINESS_ACCOUNT_ID to be set.
Webhooks
1. Verify the webhook subscription (GET endpoint)
Meta sends a GET request to your webhook URL to verify ownership. Return the challenge value as a plain text response.
2. Process incoming events (POST endpoint)
Meta sends a POST request with an HMAC-SHA256 signature in the X-Hub-Signature-256 header. Always verify it before processing.
Error Handling
Every API method returns an Illuminate\Http\Client\Response object. The SDK does not throw exceptions on 4xx/5xx responses from Meta — you decide how to handle them.
Checking the response
Common Meta error codes
| Code | Meaning | Action |
|---|---|---|
| 0 | Unknown / generic error | Check message for details |
| 10 | App does not have permission | Review app permissions in Meta dashboard |
| 100 | Invalid parameter | Check the request payload |
| 130429 | Rate limit hit | Back off and retry after a delay |
| 131030 | Recipient phone number not on WhatsApp | Verify the number before sending |
| 131047 | Re-engagement message not allowed | Send a template to re-open the window |
| 131051 | Message type unsupported for this recipient | Try a different message type |
| 190 | Access token expired or invalid | Refresh or regenerate the token |
Throwing on failure
If you prefer exceptions over manual checks, chain ->throw():
Network errors
Timeouts and connection failures throw Illuminate\Http\Client\ConnectionException regardless of the ->throw() chain. Catch it at the boundary where you call the SDK:
SDK-level exceptions
InvalidArgumentException is thrown before any HTTP request is made in these cases:
- Missing or empty
WHATSAPP_TOKENorWHATSAPP_PHONE_NUMBER_ID - Missing
WHATSAPP_BUSINESS_ACCOUNT_IDwhen calling template management methods - Phone number contains fewer than 7 digits after stripping non-numeric characters
- File path passed to
uploadMedia()does not exist - Webhook verification token mismatch or invalid
hub.mode - Webhook payload signature does not match the expected HMAC-SHA256 hash
These are programmer-configuration errors. They should surface during development, not be silently swallowed in production.
Dynamic Configuration (Multi-tenant)
Override the default token or phone number ID per request. The facade returns a cloned instance — the singleton is never mutated.
Testing
Since the package uses Laravel's native HTTP client, testing requires no real API connections:
Run the package's own test suite:
License
The MIT License (MIT). Please see the License File for more information.