PHPackages                             ziming/laravel-crisp-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ziming/laravel-crisp-whatsapp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ziming/laravel-crisp-whatsapp
=============================

This is my package laravel-crisp-whatsapp

1.2.1(1mo ago)115.0k↓41.9%MITPHPPHP ^8.2CI passing

Since May 25Pushed 1w ago2 watchersCompare

[ Source](https://github.com/ziming/laravel-crisp-whatsapp)[ Packagist](https://packagist.org/packages/ziming/laravel-crisp-whatsapp)[ Docs](https://github.com/ziming/laravel-crisp-whatsapp)[ GitHub Sponsors](https://github.com/ziming)[ RSS](/packages/ziming-laravel-crisp-whatsapp/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (42)Versions (30)Used By (0)

Laravel Crisp WhatsApp
======================

[](#laravel-crisp-whatsapp)

[![Latest Version on Packagist](https://camo.githubusercontent.com/76464852583aef6e74acb61211fe7735ca88cca3f8db8849e26ec3fdc66d86e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a696d696e672f6c61726176656c2d63726973702d77686174736170702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ziming/laravel-crisp-whatsapp)[![GitHub Tests Action Status](https://camo.githubusercontent.com/084dec314df0f09dd6269b3ae844cf7bf811f19ad70915101bdad99f947f033f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a696d696e672f6c61726176656c2d63726973702d77686174736170702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ziming/laravel-crisp-whatsapp/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9082a229f6d7c83c4ac3e80cd7750e53d922a8fe0ec91b6c411a89da444e847e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a696d696e672f6c61726176656c2d63726973702d77686174736170702f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ziming/laravel-crisp-whatsapp/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/83b005b17ef545b8de1296128af3a20127612e59a1a13dc1748d10263a23af9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a696d696e672f6c61726176656c2d63726973702d77686174736170702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ziming/laravel-crisp-whatsapp)

Send WhatsApp Messages or Notifications with [Crisp](https://crisp.chat/?track=KszsQ9SFo8) Chat!

Support me
----------

[](#support-me)

You can use my [referral link to sign up for Crisp Chat free account. At no extra costs to you, I get a small reward if you upgrade to a paid plan at the Essentials or Plus Plan in the future.](https://crisp.chat/?track=KszsQ9SFo8)

I highly recommend Crisp Chat if you are looking for a chat support SaaS for your website. As it charges a flat monthly fee instead of charging by per seat. It has a very nice UI, powerful bot builder &amp; healthy plugins ecosystem as well.

Side Note: Looking to integrate with Crisp in non WhatsApp ways? Check out my [Laravel Crisp package](https://github.com/ziming/laravel-crisp) too!

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

[](#installation)

You can install the package via composer:

```
composer require ziming/laravel-crisp-whatsapp
```

You may publish the config file with:

```
php artisan vendor:publish --tag="crisp-whatsapp-config"
```

You may also publish the migration file if you want to log your whatsapp requests with

```
php artisan vendor:publish --tag="crisp-whatsapp-migrations"```
```

And set `CRISP_WHATSAPP_LOG_REQUESTS` in your `.env` file to true

This is the contents of the published config file:

```
declare(strict_types=1);

return [
    'website_id' => env('CRISP_WEBSITE_ID'),

    'base_url' => env('CRISP_BASE_URL', 'https://plugins.crisp.chat/urn:crisp.im:whatsapp:0/wa/api/website/'),
    'access_key_id' => env('CRISP_WHATSAPP_ACCESS_KEY_ID'),
    'secret_access_key' => env('CRISP_WHATSAPP_SECRET_ACCESS_KEY'),
    'from_phone' => env('CRISP_WHATSAPP_FROM_PHONE'),

    // change it to false when you are ready for production
    'test_mode' => env('CRISP_WHATSAPP_TEST_MODE', true),

    // when test_mode is true, all whatsapp notifications will go to this number
    'to_test_phone' => env('CRISP_WHATSAPP_TO_TEST_PHONE'),

    'enable_caching' => env('CRISP_WHATSAPP_ENABLE_CACHE', true),

    // if you want to log whatsapp requests, you will need to publish migration if this is true
    'log_requests' => env('CRISP_WHATSAPP_LOG_REQUESTS', false),
];
```

Quick Usage (More documentation in the future!)
-----------------------------------------------

[](#quick-usage-more-documentation-in-the-future)

Here are some examples on how you can use it in a laravel notification class.

### Quick Example (Recommended as it greatly simplify things as most of the whatsapp template is auto generated for you after fetching)

[](#quick-example-recommended-as-it-greatly-simplify-things-as-most-of-the-whatsapp-template-is-auto-generated-for-you-after-fetching)

```
declare(strict_types=1);

use \Illuminate\Http\Client\ConnectionException;
use Ziming\LaravelCrispWhatsApp\Enums\ParameterTypeEnum;
use Ziming\LaravelCrispWhatsApp\CrispWhatsAppChannel;
use Ziming\LaravelCrispWhatsApp\Enums\ParameterTypeEnum;
use Ziming\LaravelCrispWhatsApp\CrispWhatsAppMessage;
use Ziming\LaravelCrispWhatsApp\Interfaces\CrispWhatsAppNotification;
use Ziming\LaravelCrispWhatsApp\CanReceiveCrispWhatsAppNotification;
use Ziming\LaravelCrispWhatsApp\Factories\ComponentParameterFactory;
use Ziming\LaravelCrispWhatsApp\Factories\ComponentFactory;
use Ziming\LaravelCrispWhatsApp\Enums\ButtonSubTypeEnum;
use Ziming\LaravelCrispWhatsApp\LaravelCrispWhatsApp;
use Ziming\LaravelCrispWhatsApp\Facades\LaravelCrispWhatsApp as LaravelCrispWhatsAppFacade;

class OrderShippedNotification extends Notification implements CrispWhatsAppNotification
{
    use Queueable;

    public function via(CanReceiveCrispWhatsAppNotification $notifiable): array
    {
        return [
            CrispWhatsAppChannel::class;
        ];
    }

    /**
     * @throws ConnectionException
     */
    public function toCrispWhatsApp(CanReceiveCrispWhatsAppNotification $notifiable): CrispWhatsAppMessage
    {
        $templateArray = LaravelCrispWhatsAppFacade::getMessageTemplateArray('hello_world');

        return CrispWhatsAppMessageFactory::createFromTemplateArray(
            $templateArray,
            [
                ComponentParameterFactory::text('Crispy Fries'),
            ],
        );
    }
}
```

### Detailed Example (If you want a lot more control over your whatsapp message)

[](#detailed-example-if-you-want-a-lot-more-control-over-your-whatsapp-message)

```
declare(strict_types=1);

use \Illuminate\Http\Client\ConnectionException;
use Ziming\LaravelCrispWhatsApp\Enums\ParameterTypeEnum;
use Ziming\LaravelCrispWhatsApp\CrispWhatsAppChannel;
use Ziming\LaravelCrispWhatsApp\Enums\ParameterTypeEnum;
use Ziming\LaravelCrispWhatsApp\CrispWhatsAppMessage;
use Ziming\LaravelCrispWhatsApp\Interfaces\CrispWhatsAppNotification;
use Ziming\LaravelCrispWhatsApp\CanReceiveCrispWhatsAppNotification;
use Ziming\LaravelCrispWhatsApp\Factories\ComponentParameterFactory;
use Ziming\LaravelCrispWhatsApp\Factories\ComponentFactory;
use Ziming\LaravelCrispWhatsApp\Enums\ButtonSubTypeEnum;
use Ziming\LaravelCrispWhatsApp\LaravelCrispWhatsApp;
use Ziming\LaravelCrispWhatsApp\Facades\LaravelCrispWhatsApp as LaravelCrispWhatsAppFacade;

class OrderShippedNotification extends Notification implements CrispWhatsAppNotification
{
    use Queueable;

    public function via(CanReceiveCrispWhatsAppNotification $notifiable): array
    {
        return [
            CrispWhatsAppChannel::class;
        ];
    }

    /**
     * @throws ConnectionException
     */
    public function toCrispWhatsApp(CanReceiveCrispWhatsAppNotification $notifiable): CrispWhatsAppMessage
    {
        // See the source code for more methods on CrispWhatsAppMessage!
        $crispMessages = []

        // Example 1
        $crispMessages[] =  CrispWhatsAppMessage::make()
            ->templateLanguage('en')
            ->toNumber($notifiable->mobile_phone)
            ->templateName('template-name')
            ->addTemplateBodyComponent(
                LaravelCrispWhatsApp::make()->getMessageTemplateBodyText('template-name'),
                [
                    ComponentParameterFactory::text('Crisp'),
                ]
            )
            ->addTemplateFooterComponent(
                // you may use the facade as well!
                LaravelCrispWhatsAppFacade::getMessageTemplateFooterText('template-name')
            )
            ->addTemplateButtonComponent('CTA', ButtonSubTypeEnum::Url)
            ->addTemplateButtonComponent('Not interested anymore');

           // Example 2
           $crispMessages[] =  CrispWhatsAppMessage::make()
                ->rawMessageTemplate([
                    'language' => 'en_US',
                    'name' => 'hello_world',
                    'components' => [
                        [
                            'type' => 'HEADER',
                            'FORMAT' => 'TEXT',
                            'text' => 'Hello World',
                        ],
                        [
                            'type' => 'BODY',
                            'text' => 'This is a body text',
                        ],
                        [
                            'type' => 'FOOTER',
                            'text' => 'This is a footer text',
                        ],
                    ],
                ]);

            // Example 3
            $crispMessages[] => CrispWhatsAppMessage::make()
                ->templateLanguage('en')
                ->toNumber($notifiable->mobile_phone)
                ->rawTemplateComponents([
                    ComponentFactory::headerText('Order #12345'),
                    ComponentFactory::body('{{1}} the Builder', ComponentParameterFactory::text('Crisp')),
                    ComponentFactory::button('Call To Action', ButtonSubTypeEnum::Url)
                    ComponentFactory::button('No', ButtonSubTypeEnum::QuickReply)
                    ComponentFactory::footer('This is the footer of your whatsapp template'),
                ]);

         return $crispMessages[random_int(0, 2)];
    }
}
```

Then in your model classes that can receive WhatsApp notifications, you can use the `CanReceiveWhatsAppNotification` trait:

Below is an example:

```
use Illuminate\Database\Eloquent\Model;
use Ziming\LaravelCrispWhatsApp\Interfaces\CanReceiveCrispWhatsAppNotification;

class User extends Model implements CanReceiveCrispWhatsAppNotification
{
    public function routeNotificationForCrispWhatsApp(): string
    {
        return $this->attributes['mobile_phone'];
    }
}
```

Caching
-------

[](#caching)

Caching is enabled by default. You can disable it by setting the `CRISP_WHATSAPP_ENABLE_CACHING` environment variable to `false`.

When caching is enabled, the package will cache the message template for an hour. This is to reduce the number of API calls made to Crisp.

This package also uses the `spatie/laravel-data` package to build the data objects. You may wish to refer its [structure caching documentation](https://spatie.be/docs/laravel-data/v4/advanced-usage/performance) too.

Why are the classes final?
--------------------------

[](#why-are-the-classes-final)

This is selfish on my part, my hope is that it would incentivise you to make a pull request so that everyone would benefit. I will also get to know more about where my package is lacking especially in the early days of this library.

Testing
-------

[](#testing)

Sending whatsapp messages costs money. Hence there are no tests. So if there are issues, just create an issue to let me know or make a PR fix for it :)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [ziming](https://github.com/ziming)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance96

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 90.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 ~14 days

Recently: every ~69 days

Total

27

Last Release

35d ago

Major Versions

0.14.1 → 1.02025-08-08

PHP version history (2 changes)0.1PHP ^8.4

1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/20bbe714df709bd31994360fbba65adce9f28fd930c5590265d4d58c452fe32e?d=identicon)[ziming.opensource](/maintainers/ziming.opensource)

---

Top Contributors

[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (137 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")

---

Tags

crispcrisp-chathacktoberfestlaravelwhatsappwhatsapp-apiwhatsapp-business-apiphplaravellaravel-crisp-whatsapp

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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