Download the PHP package axolotesource/laravel-whatsapp-api without Composer
On this page you can find all versions of the php package axolotesource/laravel-whatsapp-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download axolotesource/laravel-whatsapp-api
More information about axolotesource/laravel-whatsapp-api
Files in axolotesource/laravel-whatsapp-api
Package laravel-whatsapp-api
Short Description This Laravel package facilitates sending WhatsApp messages seamlessly within your application. With easy integration, it empowers developers to incorporate WhatsApp messaging functionality, enhancing user engagement and communication in a straightforward manner.
License MIT
Informations about the package laravel-whatsapp-api
Laravel WhatsApp API
Laravel package to easily send WhatsApp messages using the WhatsApp Cloud API (Graph API).
Table of Contents
- Installation
- Environment variables
- Features
- Usage
- Text messages
- Sending templates
- Interactive buttons
- Interactive lists
- Sending images
- Sending video by URL
- Uploading media
- Raw messages
- Querying registered templates on Meta
- Test mode
- toArray method
- API Reference
- License
Installation
Publish the configuration file:
Environment variables (.env)
Features
| Feature | Status |
|---|---|
| Text messages | ✅ |
| Templates with components | ✅ |
| Interactive buttons (up to 3) | ✅ |
| Interactive lists with sections | ✅ |
| Images (by media ID) | ✅ |
| Images (by URL) | ✅ |
| Videos (by URL) | ✅ |
| Raw messages | ✅ |
| Image upload | ✅ |
| Video upload | ✅ |
| Retrieve media metadata | ✅ |
| Query registered templates (WhatsAppTemplate) | ✅ |
| Template pagination | ✅ |
| Test / fake mode | ✅ |
| Document sending | ❌ (TODO) |
| Document upload | ❌ (TODO) |
| Audio upload | ❌ (TODO) |
| Sticker upload | ❌ (TODO) |
| Audio messages | ❌ |
| Sticker messages | ❌ |
| Location messages | ❌ |
| Contact messages | ❌ |
| Reaction messages | ❌ |
| Catalogs / multi-product | ❌ |
| Flow messages | ❌ |
| Webhook handling | ❌ |
| Business profile | ❌ |
Usage
Sending templates
The first message to a new contact must be a Meta-approved template.
If you don't pass a template name, it will use the default_initial_templete config value.
Template components
- BodyComponent – Message body
- HeaderComponent – Header
- ButtonComponent – Buttons (supports
QUICK_REPLYandURL)
Parameters
Text messages
Using textMessage (replaces text, which is deprecated):
Interactive buttons
Up to 3 quick reply buttons.
Also supports media headers:
Interactive lists
Sending images
By media ID (requires uploading the file first):
By URL:
Sending video by URL
Uploading media
Raw messages
For fully custom requests:
Querying registered templates on Meta
WhatsAppTemplate allows you to retrieve information about templates registered in your WhatsApp Business account.
Get all templates
Filters
Selecting fields
Available fields: id, name, status, category, language, components, last_updated_time, quality_score, rejected_reason.
Limit results
Pagination
TemplateDTO
Each template is returned as a TemplateDTO with the following properties:
| Property | Type | Description |
|---|---|---|
id |
string |
Template ID |
name |
string |
Template name |
status |
string |
Status (APPROVED, PENDING, REJECTED, etc.) |
category |
string |
Category (MARKETING, UTILITY, AUTHENTICATION) |
language |
string |
Language code |
components |
array |
Array of ComponentDTO |
Fake mode
Test mode
When WHATSAPP_BUSINESS_TEST_MODE=true, all messages are automatically redirected to WHATSAPP_BUSINESS_TEST_NUMBER.
toArray() method
You can get the payload without sending it:
API Reference
| Method | Description |
|---|---|
WhatsAppMessages::text($to, $previewUrl) |
Simple text message |
WhatsAppMessages::textMessage($to, $previewUrl) |
Text message (replaces text) |
WhatsAppMessages::templete($to, $templateName) |
Send approved template |
WhatsAppMessages::interactiveButtons($to) |
Interactive buttons (up to 3) |
WhatsAppMessages::interactiveList($to) |
Interactive list with sections |
WhatsAppMessages::image($to, Media $media) |
Image by media ID |
WhatsAppMessages::imageByUrl($to, $url) |
Image by URL |
WhatsAppMessages::videoByUrl($to, $url) |
Video by URL |
WhatsAppMessages::raw($request, $to, $params) |
Raw payload with variable replacement |
WhatsAppMessages::test($to) |
Send "hello_world" test template |
WhatsAppMessages::fake() |
Enable fake responses for testing |
WhatsAppTemplate::all() |
Get all registered templates |
WhatsAppTemplate::get() |
Get templates with filters |
WhatsAppTemplate::list() |
Get templates with pagination (TemplateList) |
WhatsAppTemplate::where($field, $value) |
Filter by status, category, name, language |
WhatsAppTemplate::whereIn($field, $values) |
Filter by multiple values |
WhatsAppTemplate::select($fields) |
Select specific fields |
WhatsAppTemplate::limit($n) |
Limit number of results |
License
MIT