PHPackages                             axolotesource/laravel-whatsapp-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. axolotesource/laravel-whatsapp-api

ActiveLibrary[API Development](/categories/api)

axolotesource/laravel-whatsapp-api
==================================

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.

v1.1.1(3w ago)456[1 issues](https://github.com/AxoloteSource/laravel-whatsapp-api/issues)MITPHPPHP &gt;=7.4

Since Nov 21Pushed 8mo ago3 watchersCompare

[ Source](https://github.com/AxoloteSource/laravel-whatsapp-api)[ Packagist](https://packagist.org/packages/axolotesource/laravel-whatsapp-api)[ RSS](/packages/axolotesource-laravel-whatsapp-api/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

Laravel WhatsApp API
====================

[](#laravel-whatsapp-api)

[![Latest Version](https://camo.githubusercontent.com/f98d80d2db22e73354240e44033660c8102e86ed0750b0308688f85fe2cf3175/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61786f6c6f7465736f757263652f6c61726176656c2d77686174736170702d617069)](https://packagist.org/packages/axolotesource/laravel-whatsapp-api)[![Total Downloads](https://camo.githubusercontent.com/df8b0f2fb4356d920eab6e190e0683b5fbc3df6957c558ccd678bfb87beae277/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61786f6c6f7465736f757263652f6c61726176656c2d77686174736170702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/axolotesource/laravel-whatsapp-api)[![License](https://camo.githubusercontent.com/29e3726b62d16e04cf88d9879c53cabb29ce1a8e5eb63aa723356c95e0dd8bab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61786f6c6f7465736f757263652f6c61726176656c2d77686174736170702d617069)](LICENSE)

Laravel package to easily send WhatsApp messages using the WhatsApp Cloud API (Graph API).

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Environment variables](#environment-variables-env)
- [Features](#features)
- [Usage](#usage)
    - [Text messages](#text-messages)
    - [Sending templates](#sending-templates)
    - [Interactive buttons](#interactive-buttons)
    - [Interactive lists](#interactive-lists)
    - [Sending images](#sending-images)
    - [Sending video by URL](#sending-video-by-url)
    - [Uploading media](#uploading-media)
    - [Raw messages](#raw-messages)
    - [Querying registered templates on Meta](#querying-registered-templates-on-meta)
    - [Test mode](#test-mode)
    - [toArray method](#toarray-method)
- [API Reference](#api-reference)
- [License](#license)

Installation
------------

[](#installation)

```
composer require axolotesource/laravel-whatsapp-api
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Axolotesource\LaravelWhatsappApi\LaravelWhatsappApiServiceProvider"
```

### Environment variables (`.env`)

[](#environment-variables-env)

```
WHATSAPP_BUSINESS_ACCOUNT_ID=
WHATSAPP_BUSINESS_PHONE_NUMBER_ID=
WHATSAPP_BUSINESS_BEARER=
WHATSAPP_HOOK_VERIFY_TOKEN=
WHATSAPP_BUSINESS_API=https://graph.facebook.com/v23.0/
WHATSAPP_BUSINESS_TEST_NUMBER=
WHATSAPP_BUSINESS_TEST_MODE=false
DEFAULT_INITIAL_TEMPLETE=default
WHATSAPP_RAW_TEMPLETE=
TEMPLETE_IMAGEN_HEAD=
DISABLE_WHATSAPP_HOOK=false
REPLICATE_WHATSAPP_HOOK_URLS=[]
```

### Features

[](#features)

FeatureStatusText 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
-----

[](#usage)

### Sending templates

[](#sending-templates)

The first message to a new contact must be a Meta-approved template.

```
WhatsAppMessages::templete('521234567890')
    ->language('es_MX')
    ->addComponents([
        BodyComponent::create([
            Params::text('This is a test message')
        ]),
        ButtonComponent::create([
            Params::button('yes')
        ]),
        ButtonComponent::create([
            Params::button('no')
        ]),
        ButtonComponent::create(
            [
                Params::button('history/login?folio=123ABC')
            ],
            ButtonComponent::SUB_TYPE_URL
        ),
        ButtonComponent::create([
            Params::button('never')
        ])
    ]);
```

If you don't pass a template name, it will use the `default_initial_templete` config value.

#### Template components

[](#template-components)

- **BodyComponent** – Message body
- **HeaderComponent** – Header
- **ButtonComponent** – Buttons (supports `QUICK_REPLY` and `URL`)

#### Parameters

[](#parameters)

```
Params::text(string $text, ?string $parameterName = null)
Params::button(string $payload)
Params::imageFromUrl(string $url)
```

### Text messages

[](#text-messages)

```
use Axolotesource\LaravelWhatsappApi\WhatsAppMessages\WhatsAppMessages;

WhatsAppMessages::text('521234567890')
    ->body('Hello, this is a text message')
    ->send();

// You can also disable URL previews
WhatsAppMessages::text('521234567890', false)
    ->body('Message without URL preview')
    ->send();
```

Using `textMessage` (replaces `text`, which is deprecated):

```
WhatsAppMessages::textMessage('521234567890')
    ->body('Hello world')
    ->send();
```

### Interactive buttons

[](#interactive-buttons)

Up to 3 quick reply buttons.

```
WhatsAppMessages::interactiveButtons('521234567890')
    ->setHeaderText('Optional header')
    ->body('Message body')
    ->footer('Optional footer')
    ->addButton('Option 1', 1)
    ->addButton('Option 2', 2)
    ->addButton('Option 3', 3)
    ->send();
```

Also supports media headers:

```
WhatsAppMessages::interactiveButtons('521234567890')
    ->setHeaderImage('https://example.com/image.jpg')
    ->body('Message body')
    ->addButton('Yes', 'yes')
    ->addButton('No', 'no')
    ->send();
```

### Interactive lists

[](#interactive-lists)

```
WhatsAppMessages::interactiveList('521234567890')
    ->body('Choose an option:')
    ->button('View options')
    ->addSection('Section 1', [
        Row::create('Row title 1', 'id-1', 'Optional description'),
        Row::create('Row title 2', 'id-2'),
    ])
    ->addSection('Section 2', [
        Row::create('Row title 3', 'id-3'),
    ])
    ->send();
```

### Sending images

[](#sending-images)

By media ID (requires uploading the file first):

```
$media = WhatsAppMedia::image('/local/path/image.jpg')->upload();

WhatsAppMessages::image('521234567890', $media)
    ->send();
```

By URL:

```
WhatsAppMessages::imageByUrl('521234567890', 'https://example.com/image.jpg')
    ->send();
```

### Sending video by URL

[](#sending-video-by-url)

```
WhatsAppMessages::videoByUrl('521234567890', 'https://example.com/video.mp4')
    ->send();
```

### Uploading media

[](#uploading-media)

```
use Axolotesource\LaravelWhatsappApi\WhatsAppMessages\WhatsAppMedia;

// Upload image
$media = WhatsAppMedia::image('/path/image.jpg')->upload();

// Upload video
$media = WhatsAppMedia::video('/path/video.mp4')->upload();

// Retrieve media metadata by ID
$media = WhatsAppMedia::retrieve('MEDIA_ID')->get();
```

### Raw messages

[](#raw-messages)

For fully custom requests:

```
WhatsAppMessages::raw([
    'type' => 'text',
    'text' => [
        'body' => 'Hello {{name}}'
    ],
], '521234567890', ['name' => 'John'])
    ->send();
```

### Querying registered templates on Meta

[](#querying-registered-templates-on-meta)

`WhatsAppTemplate` allows you to retrieve information about templates registered in your WhatsApp Business account.

```
use Axolotesource\LaravelWhatsappApi\WhatsAppMessages\WhatsAppTemplate;
```

#### Get all templates

[](#get-all-templates)

```
$templates = WhatsAppTemplate::all(); // Collection of TemplateDTO
```

#### Filters

[](#filters)

```
// By status
WhatsAppTemplate::where('status', 'APPROVED')->get();

// By category
WhatsAppTemplate::where('category', 'UTILITY')->get();

// By name
WhatsAppTemplate::where('name', 'my_template')->get();

// By language
WhatsAppTemplate::where('language', 'es_MX')->get();

// Multiple values
WhatsAppTemplate::whereIn('status', ['APPROVED', 'PENDING'])->get();
```

#### Selecting fields

[](#selecting-fields)

```
WhatsAppTemplate::select(['name', 'status', 'category', 'language', 'components'])->get();
```

Available fields: `id`, `name`, `status`, `category`, `language`, `components`, `last_updated_time`, `quality_score`, `rejected_reason`.

#### Limit results

[](#limit-results)

```
WhatsAppTemplate::limit(10)->get();
```

#### Pagination

[](#pagination)

```
$list = WhatsAppTemplate::list(); // TemplateList

foreach ($list->data() as $template) {
    echo $template->name . ' - ' . $template->status;
}

if ($list->hasNextPage()) {
    $nextPage = $list->nextPage();
}
```

#### TemplateDTO

[](#templatedto)

Each template is returned as a `TemplateDTO` with the following properties:

PropertyTypeDescription`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

[](#fake-mode)

```
WhatsAppMessages::fake();
WhatsAppTemplate::all(); // returns simulated data
```

### Test mode

[](#test-mode)

```
// Activate to send all messages to the test number
WhatsAppMessages::fake();
```

When `WHATSAPP_BUSINESS_TEST_MODE=true`, all messages are automatically redirected to `WHATSAPP_BUSINESS_TEST_NUMBER`.

### `toArray()` method

[](#toarray-method)

You can get the payload without sending it:

```
$payload = WhatsAppMessages::text('521234567890')
    ->body('Hello')
    ->toArray();
```

API Reference
-------------

[](#api-reference)

MethodDescription`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 resultsLicense
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance71

Regular maintenance activity

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~933 days

Total

2

Last Release

21d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15320788?v=4)[Luis Ozuna](/maintainers/LuisOzParr)[@LuisOzParr](https://github.com/LuisOzParr)

---

Top Contributors

[![LuisOzParr](https://avatars.githubusercontent.com/u/15320788?v=4)](https://github.com/LuisOzParr "LuisOzParr (4 commits)")[![brianfp](https://avatars.githubusercontent.com/u/15164262?v=4)](https://github.com/brianfp "brianfp (1 commits)")[![Wolfernand](https://avatars.githubusercontent.com/u/1784169?v=4)](https://github.com/Wolfernand "Wolfernand (1 commits)")

---

Tags

laravelwhatsapp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/axolotesource-laravel-whatsapp-api/health.svg)

```
[![Health](https://phpackages.com/badges/axolotesource-laravel-whatsapp-api/health.svg)](https://phpackages.com/packages/axolotesource-laravel-whatsapp-api)
```

###  Alternatives

[xaamin/whatsapi

Wrapper for Whatsapp messenger

1342.8k](/packages/xaamin-whatsapi)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

783.8k](/packages/scriptdevelop-whatsapp-manager)[crenspire/laravel-whatsapp

Laravel WhatsApp Business API package

225.4k](/packages/crenspire-laravel-whatsapp)[samuelterra22/laravel-evolution-client

Laravel Client for Evolution API, allowing easy integration with WhatsApp.

112.1k](/packages/samuelterra22-laravel-evolution-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
