PHPackages                             wmspace/laravel-whatsapp - 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. wmspace/laravel-whatsapp

ActiveLibrary[API Development](/categories/api)

wmspace/laravel-whatsapp
========================

Fork of a Whatsapp Business Cloud API wrapper for Laravel 13

0.8.8(1mo ago)09MITPHPPHP ^8.3

Since Jul 5Pushed 1mo agoCompare

[ Source](https://github.com/WMspace/laravel-whatsapp)[ Packagist](https://packagist.org/packages/wmspace/laravel-whatsapp)[ RSS](/packages/wmspace-laravel-whatsapp/feed)WikiDiscussions master Synced 1mo ago

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

Whatsapp Business Cloud API for Laravel 13
==========================================

[](#whatsapp-business-cloud-api-for-laravel-13)

A Laravel package for the [Whatsapp Business Cloud API](https://developers.facebook.com/docs/whatsapp/cloud-api).

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Media](#media)
    - [Business profile](#business-profile)
- [Notification Channel](#notification-channel)
- [License](#license)

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

[](#installation)

```
composer require wmspace/laravel-whatsapp
```

Configuration
-------------

[](#configuration)

You will need to set the `WHATSAPP_TOKEN` and `WHATSAPP_NUMBER_ID` values in your .env.

For further configuration, please see [config/whatsapp.php](config/whatsapp.php). You can modify the configuration by copying it to your local `config` directory or by defining the environment variables used in the config file:

```
php artisan vendor:publish --provider="MissaelAnda\Whatsapp\WhatsappServiceProvider" --tag=config
```

Usage
-----

[](#usage)

You can send a messages to a single or multiple clients.

```
use MissaelAnda\Whatsapp\Messages;

Whatsapp::send('13333333333', Messages\TemplateMessage::create()
    ->name('one_time_password')
    ->language('en_US')
    ->body(Messages\Components\Body::create([
        Messages\Components\Parameters\Text::create('000000'),
    ])));
```

You can also respond to other messages in the conversation with any message type (except reaction message):

```
use MissaelAnda\Whatsapp\Messages\TextMessage;

Whatsapp::send('13333333333', TextMessage::create('Answer to your message')->respondTo('wamid.91n23...'));
```

and you can mark messages as read:

```
Whatsapp::markRead('wamid.91n23...');
```

By default the messages will be sent from the `default_number_id`, if you want to use other you can use `Whatsapp::numberId()` or add the alias to the config's `numbers` list and use `Whatsapp::numberName()`. Also you can set the token manually with `Whatsapp::token()` or you can set both the token and numberId you can use `Whatsapp::client()`

### Supported messages

[](#supported-messages)

- Text Message
- Media Message
- Template Message
- Reaction Message
- Contacts Message
- Interactive Message
- Location Message

### Media

[](#media)

You can also [manage media](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media) with:

```
Whatsapp::uploadMedia(string $file, string $type = null, bool $retrieveAllData = true): \MissaelAnda\Whatsapp\WhatsappMedia|string
Whatsapp::getMedia(string $mediaId, bool $download = false): \MissaelAnda\Whatsapp\WhatsappMedia
Whatsapp::deleteMedia(\MissaelAnda\Whatsapp\WhatsappMedia|string $id): bool
Whatsapp::downloadMedia(string|\MissaelAnda\Whatsapp\WhatsappMedia $media): \MissaelAnda\Whatsapp\WhatsappMedia
```

### Business Profile

[](#business-profile)

There are also two ways to manage the number's business profile:

```
Whatsapp::getProfile(): \MissaelAnda\Whatsapp\BusinessProfile
Whatsapp::updateProfile(\MissaelAnda\Whatsapp\BusinessProfile|array $data): bool
```

Webhooks
--------

[](#webhooks)

Whatsapp allows you to subscribe to [webhooks](https://developers.facebook.com/docs/whatsapp/cloud-api/guides/set-up-webhooks) to receive notifications and most importantly messages from your customers. Both subscriptions and notifications are handled out of the box in the route whatsapp/webhook (you can change the path with the WHATSAPP\_WEBHOOK\_PATH env variable).

When a you register the webhook meta will send a subscription, this requires a verification token that you set, you will need to set it with WHATSAPP\_WEBHOOK\_VERIFY\_TOKEN env setting. When receiving a subscription intent a `MissaelAnda\Whatsapp\Events\SubscriptionIntentReceived` event will be fired, if the request is successful the `MissaelAnda\Whatsapp\Events\SuccessfullySubscribed` event will fire too.

On the other hand notifications will trigger a `MissaelAnda\Whatsapp\Events\WebhookReceived` event with all the payload, if you want to protect this route verifying the sha256 signature you must set the WHATSAPP\_WEBHOOK\_SIGNATURE\_VERIFY to true and the WHATSAPP\_SECRET to your whatsapp's app secret.

If the payload is invalid a `MissaelAnda\Whatsapp\Events\UnprocessableWebhookPayload` event will be fired with the exception describing the error.

If you want to know when a specific notification is fired you can subscribe to this events:

- `MissaelAnda\Whatsapp\Events\WebhookEntry` generic entry
- `MissaelAnda\Whatsapp\Events\MessagesReceived` for the `messages` entry

Notification Channel
--------------------

[](#notification-channel)

This library has support for channel notification, just add the `routeNotificationForWhatsapp()` function to the Notifiable user (it can return a single whatsapp\_id or an array of them):

```
class User extends Authenticatable
{
    use Notifiable;

    /**
     * @return string|array
     */
    public function routeNotificationForWhatsapp(): string|array
    {
        return "{$this->phone_code}{$this->phone}";
    }
}
```

Now just create a notification that implements the `toWhatsapp()` function:

```
//...
use MissaelAnda\Whatsapp\Messages\TemplateMessage;
use MissaelAnda\Whatsapp\Messages\Components\Parameters;
use MissaelAnda\Whatsapp\WhatsappChannel;

class VerificationCode extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(protected string $code)
    {
        //
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [WhatsappChannel::class];
    }

    /**
     * Get the message representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \MissaelAnda\Whatsapp\Messages\WhatsappMessage
     */
    public function toWhatsapp($notifiable)
    {
        return TemplateMessage::create('one_time_password')
            ->language('en_US')
            ->body([
                Parameters\Text::create('123456'),
            ]);
    }
}
```

Now you can send whatsapp notifications:

```
$user->notify(new VerificationCode('12345678'));
```

Configuration file
------------------

[](#configuration-file)

```
return [
    /**
     * The whatsapp token to be used.
     */
    'token' => env('WHATSAPP_TOKEN'),

    /**
     * The whatsapp's app secret code. Required for webhook request signature verification.
     */
    'secret' => env('WHATSAPP_SECRET'),

    /**
     * The default NUMBER ID used to send the messages.
     */
    'default_number_id' => env('WHATSAPP_NUMBER_ID'),

    /**
     * If you want to use other number id's you can add them here so you can call
     * `numberName` with the name you provide here and make it easier to change
     * the phone where the messages are sended.
     */
    'numbers' => [
        // 'fallback' => env('WHATSAPP_FALLBACK_NUMBER_ID'),
    ],

    'webhook' => [
        /**
         * Wether to enable the webhook routes
         */
        'enabled' => env('WHATSAPP_WEBHOOK_ENABLED', true),

        /**
         * The webhook path, by default "/whatsapp/webhook"
         */
        'path' => env('WHATSAPP_WEBHOOK_PATH', 'whatsapp'),

        /**
         * The webhook verification token.
         * For more information check https://developers.facebook.com/docs/graph-api/webhooks/getting-started#verification-requests
         */
        'verify_token' => env('WHATSAPP_WEBHOOK_VERIFY_TOKEN'),

        /**
         * Wether the webhook request signature should be verified or not.
         */
        'verify_signature' => env('WHATSAPP_WEBHOOK_SIGNATURE_VERIFY', false),
    ],
];
```

Missing features
----------------

[](#missing-features)

- Register/deregister/validate new phone numbers

License
-------

[](#license)

This project is licensed under the [MIT License](LICENSE).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~129 days

Total

3

Last Release

52d ago

PHP version history (2 changes)0.8.6PHP ^8.1

0.8.8PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/9da3a505af906010a1465f2a50a52a9568ef84b553a2eea2778467e44a67e550?d=identicon)[WMspace](/maintainers/WMspace)

---

Top Contributors

[![MissaelAnda](https://avatars.githubusercontent.com/u/31199350?v=4)](https://github.com/MissaelAnda "MissaelAnda (32 commits)")[![WMspace](https://avatars.githubusercontent.com/u/16805714?v=4)](https://github.com/WMspace "WMspace (4 commits)")

---

Tags

apilaravelsdkfacebookwhatsapp

### Embed Badge

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

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

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[missael-anda/laravel-whatsapp

A Whatsapp Business Cloud API wrapper for Laravel.

677.5k](/packages/missael-anda-laravel-whatsapp)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)

PHPackages © 2026

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