PHPackages                             ka4ivan/laravel-notification-channel-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. ka4ivan/laravel-notification-channel-whatsapp

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

ka4ivan/laravel-notification-channel-whatsapp
=============================================

Whatsapp Notifications Channel for Laravel

1.4.0(2w ago)6861↑149%1MITPHPPHP &gt;=8.1CI failing

Since May 16Pushed 2w ago1 watchersCompare

[ Source](https://github.com/ka4ivan/laravel-notification-channel-whatsapp)[ Packagist](https://packagist.org/packages/ka4ivan/laravel-notification-channel-whatsapp)[ Docs](https://github.com/ka4ivan/laravel-notification-channel-whatsapp)[ RSS](/packages/ka4ivan-laravel-notification-channel-whatsapp/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (9)Versions (10)Used By (0)

Whatsapp Notifications Channel for Laravel
==========================================

[](#whatsapp-notifications-channel-for-laravel)

[![License](https://camo.githubusercontent.com/7c0b959570e74f421f60d16655f47b84cf9b6fd2489c3de284065a8ed627402e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d77686174736170702e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ka4ivan/laravel-notification-channel-whatsapp)[![Build Status](https://camo.githubusercontent.com/80364980037be251d10caf344107de7036e04dbcba809feeafc8daae38a3c34e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d77686174736170702e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/ka4ivan/laravel-notification-channel-whatsapp)[![Latest Stable Version](https://camo.githubusercontent.com/6991e58f6dedbc9255c0d6da38bff3c06d974874fd734ee6cee3231970a419bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d77686174736170702e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ka4ivan/laravel-notification-channel-whatsapp)[![Total Downloads](https://camo.githubusercontent.com/68400390ff70ae63ce082a95162417561bedef442836ce5ee1239991a0f7b3b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d77686174736170702e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ka4ivan/laravel-notification-channel-whatsapp)

This package makes it easy to send notifications using the [Whatsapp Messenger](https://developers.facebook.com/docs/whatsapp/cloud-api/get-started) with Laravel.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your WhatsApp Bot](#setting-up-your-whatsapp-bot)
    - [Set config](#set-config)
- [Usage](#usage)
    - [Types of messages](#types-of-messages)
        - [Text Message](#text-message)
        - [Reply Buttons Message](#reply-buttons-message)
        - [Call-To-Action (CTA URL) Message](#call-to-action-cta-url-message)
        - [Audio Message](#audio-message)
        - [Document Message](#document-message)
        - [Image Message](#image-message)
        - [Video Message](#video-message)
        - [Location Message](#location-message)
        - [Location Request Message](#location-request-message)
        - [Reaction](#reaction)
    - [Reply to a message (context)](#reply-to-a-message-context)
    - [Sending multiple messages](#sending-multiple-messages)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require ka4ivan/laravel-notification-channel-whatsapp
```

### Setting up your Whatsapp Bot

[](#setting-up-your-whatsapp-bot)

This document describes the steps you must take to become a [Tech Provider Whatsapp](https://developers.facebook.com/docs/whatsapp/solution-providers/get-started-for-tech-providers)

### Set config

[](#set-config)

Next we need to add tokens to our Laravel configurations. Create a new Whatsapp section inside `config/services.php` and place the page token there:

```
// config/services.php
'whatsapp' => [
    'access_token' => env('WHATSAPP_ACCESS_TOKEN', ''),
    'number_id' => env('WHATSAPP_NUMBER_ID', ''),
    'api_version' => env('WHATSAPP_API_VERSION', '22.0'),
],
```

Usage
-----

[](#usage)

You can now use the Whatsapp channel in your `via()` method, inside the InvoicePaid class. The `to($recipientId)` Whatsapp ID (Phone Number) method defines the Whatsapp user, you want to send the notification to.

```
use NotificationChannels\Whatsapp\WhatsappChannel;
use NotificationChannels\Whatsapp\WhatsappMessage;

use Illuminate\Notifications\Notification;

class ChannelConnected extends Notification
{
    public function via($notifiable)
    {
        return [WhatsappChannel::class];
    }

    public function toWhatsapp($notifiable)
    {
        $apiVersion = config('services.whatsapp.api_version');
        $accessToken = config('services.whatsapp.access_token');
        $numberId = config('services.whatsapp.number_id');

        return WhatsappMessage::create()
            ->to($notifiable->whatsapp_id)  // Optional
            ->setApiVersion($apiVersion)    // Optional
            ->setAccessToken($accessToken)  // Optional
            ->setNumberId($numberId)        // Optional
            ->previewUrl(false)             // Optional
            ->text('Congratulations, the communication channel is connected');
    }
}
```

The notification will be sent from your Whatsapp page, whose page token you have configured earlier. Here's a screenshot preview of the notification inside the chat window.

[![image](https://private-user-images.githubusercontent.com/75951574/444468103-62cebb84-2d8e-47fe-ad3c-5a49be91c151.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODMxMjkzNjQsIm5iZiI6MTc4MzEyOTA2NCwicGF0aCI6Ii83NTk1MTU3NC80NDQ0NjgxMDMtNjJjZWJiODQtMmQ4ZS00N2ZlLWFkM2MtNWE0OWJlOTFjMTUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDQlM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SUyRnBuZyJ9.J6DMx9sQQbwQb_jfD6gZSUrjVheHh8_R7Wu4BtN3dfY)

#### Message Examples

[](#message-examples)

##### Basic Text Message

[](#basic-text-message)

```
return WhatsappMessage::create('You have just paid your monthly fee! Thanks');
```

### Routing a message

[](#routing-a-message)

You can either send the notification by providing with the page-scoped user id of the recipient to the `to($recipientId)` Whatsapp ID (Phone Number) method like shown in the above example or add a `routeNotificationForWhatsapp()` method in your notifiable model:

```
/**
 * Route notifications for the Whatsapp channel.
 *
 * @return int
 */
public function routeNotificationForWhatsapp()
{
    return $this->whatsapp_id;
}
```

### Types of messages

[](#types-of-messages)

#### Audio Message

[](#audio-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `mediaId('')`: (string) Whatsapp media ID (Only if using uploaded media)
- `link('')`: (string) Media link (Only if using hosted media (not recommended))

```
WhatsappAudioMessage::create()
    ->link('audio url');
```

#### Call-To-Action (CTA URL) Message

[](#call-to-action-cta-url-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `body('')`: (string) Message body text.
- `header(null)`: (Header) Message header object. (ButtonCtaUrlImageHeader/ButtonCtaUrlTitleHeader)
- `footer('')`: (string) Message footer text.
- `button()`: (ButtonCtaUrl) Message button object.

```
WhatsappCtaUrlMessage::create()
    ->header(ButtonCtaUrlTitleHeader::create()->title('header text'))
    ->body('body text')
    ->footer('footer text')
    ->button(ButtonCtaUrl::create()->displayText('button text')->url('button url'));
```

#### Document Message

[](#document-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `caption('')`: (string) Notification caption.
- `filename('')`: (string) Document filename, with extension. The WhatsApp client will use an appropriate file type icon based on the extension.
- `mediaId('')`: (string) Whatsapp media ID (Only if using uploaded media)
- `link('')`: (string) Whatsapp media link (Only if using hosted media (not recommended))

```
WhatsappDocumentMessage::create()
    ->caption('file caption')
    ->filename('file name')
    ->link('file url');
```

#### Image Message

[](#image-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `caption('')`: (string) Notification caption.
- `mediaId('')`: (string) Whatsapp media ID (Only if using uploaded media)
- `link('')`: (string) Whatsapp media link (Only if using hosted media (not recommended))

```
WhatsappImageMessage::create()
    ->caption('image caption')
    ->link('image url');
```

#### Location Message

[](#location-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `latitude('')`: (string) The geographic latitude of the location (e.g., '50.4501').
- `longitude('')`: (string) The geographic longitude of the location (e.g., '30.5234').
- `name('')`: (string) The name or label of the location (e.g., 'Independence Square').
- `address('')`: (string) The full address (optional), displayed under the name (e.g., 'Khreshchatyk St, Kyiv, Ukraine').

```
WhatsappLocationMessage::create('latitude', 'longitude')
    ->address('address text')
    ->name('name text');
```

#### Location Request Message

[](#location-request-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `body('')`: (string) Message body text.

```
WhatsappLocationRequestMessage::create('Location, pls');
```

#### Text Message

[](#text-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `text('')`: (string) Notification message.
- `previewUrl(true)`: (boolean) [Link Preview](https://developers.facebook.com/docs/whatsapp/cloud-api/messages/text-messages).
- `setApiVersion($apiVersion)`: (string) Set Default Graph API Version.
- `setAccessToken($accessToken)`: (string) Set the access token used for authenticating API requests.
- `setNumberId($numberId)`: (string) Set the Whatsapp number ID for API requests.

```
WhatsappMessage::create('Your order has been confirmed!');
```

#### Reaction

[](#reaction)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `emoji('')`: (string) Emoji reaction. Unicode escape sequence example: \\uD83D\\uDE00. Emoji example: 😀
- `messageId('')`: (string) Whatsapp Message ID

```
WhatsappReaction::create()
    ->emoji('😊')
    ->messageId('Whatsapp message ID');
```

#### Reply Buttons Message

[](#reply-buttons-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `body('')`: (string) Message body text.
- `header(null)`: (Header) Message header object. (ButtonCtaUrlImageHeader/ButtonCtaUrlTitleHeader)
- `footer('')`: (string) Message footer text.
- `buttons([])`: (array) Message buttons array \[ButtonReply, ButtonReply, ButtonReply\].

```
WhatsappButtonReplyMessage::create()
    ->header(ButtonReplyTitleHeader::create()->title('header text'))
    ->body('body text')
    ->footer('footer text')
    ->buttons([
        ButtonReply::create()->id('button id 1')->title('button title 1'),
        ButtonReply::create()->id('button id 2')->title('button title 2'),
        ButtonReply::create()->id('button id 3')->title('button title 3'),
    ]);
```

#### Video Message

[](#video-message)

- `to($recipientId)`: (string) User (recipient) Whatsapp ID (Phone Number).
- `caption('')`: (string) Notification caption.
- `mediaId('')`: (string) Whatsapp media ID (Only if using uploaded media)
- `link('')`: (string) Whatsapp media link (Only if using hosted media (not recommended))

```
WhatsappVideoMessage::create()
    ->caption('video caption')
    ->link('video url');
```

### Reply to a message (context)

[](#reply-to-a-message-context)

All message types support reply threading via `context()`. Pass the WhatsApp message ID (`wamid`) of the message you want to reply to — the recipient will see it as a quoted reply.

- `context(string $messageId)`: WhatsApp message ID (`wamid`) to quote

```
WhatsappMessage::create('Got it, thanks!')
    ->context('wamid.HBgNxxxxxxxxxxxx');

// Works on any message type
WhatsappImageMessage::create('Here is the photo')
    ->link('https://example.com/photo.jpg')
    ->context('wamid.HBgNxxxxxxxxxxxx');
```

### Sending multiple messages

[](#sending-multiple-messages)

If you need to send multiple files (regardless of the message type)

```
/**
 * @param $notifiable
 * @return \NotificationChannels\Whatsapp\Message|array
 * @throws \NotificationChannels\Whatsapp\Exceptions\CouldNotCreateMessage
 */
public function toWhatsApp($notifiable)
{
    $text = 'text';

    $files = $this->getFiles();

    if (!empty($files)) {
        $messages = [];

        $first = true;
        foreach ($files as $url => $name) {
            $message = WhatsappDocumentMessage::create()
                ->link($url)
                ->filename(Str::substr($name, -32));

            if ($first) {
                $message->caption($text);
                $first = false;
            }

            $messages[] = $message;
        }

        return $messages;
    }

    return WhatsappMessage::create()->text($text);
}
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance97

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.1% 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 ~50 days

Recently: every ~97 days

Total

9

Last Release

16d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/75951574?v=4)[Kachula Ivan](/maintainers/ka4ivan)[@ka4ivan](https://github.com/ka4ivan)

---

Top Contributors

[![ka4ivan](https://avatars.githubusercontent.com/u/75951574?v=4)](https://github.com/ka4ivan "ka4ivan (37 commits)")[![fomvasss](https://avatars.githubusercontent.com/u/19834478?v=4)](https://github.com/fomvasss "fomvasss (5 commits)")

---

Tags

laravelwhatsapplaravel-notificationwhatsapp notificationwhatsapp-apilaravel-notification-channellaravel-whatsapplaravel messagelaravel whatsapp integrationlaravel whatsapp message

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ka4ivan-laravel-notification-channel-whatsapp/health.svg)

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

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k30.0M148](/packages/laravel-cashier)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M167](/packages/spatie-laravel-health)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[netflie/laravel-notification-whatsapp

Laravel notification driver for WhatsApp

183206.9k](/packages/netflie-laravel-notification-whatsapp)[felipedamacenoteodoro/laravel-whatsapp-notification-channel

Whatsapp Notifications Channel for Laravel

984.9k](/packages/felipedamacenoteodoro-laravel-whatsapp-notification-channel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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