Laravel WhatsApp Package: Cloud API &amp; Web Sidecar | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Laravel WhatsApp: Send Messages via Meta Cloud API and whatsapp-web.js Behind One Facade        On this page       1. [  Overview ](#overview)
2. [  Two Backends, One Facade ](#two-backends-one-facade)
3. [  Sending Messages ](#sending-messages)
4. [  Queued Sends and Inbound Events ](#queued-sends-and-inbound-events)
5. [  Optional Admin UI and Persistence ](#optional-admin-ui-and-persistence)
6. [  Getting Started ](#getting-started)
7. [  Key Takeaways ](#key-takeaways)

  ![Laravel WhatsApp: Send Messages via Meta Cloud API and whatsapp-web.js Behind One Facade](https://cdn.msaied.com/322/aba494fddab4c6e7874cd0ca99a5abc9.png)

 [  Laravel ](https://msaied.com/articles?category=laravel) [  Composer Pacakge ](https://msaied.com/articles?category=composer-pacakge)  #Laravel   #WhatsApp   #Composer Package   #Meta Cloud API   #whatsapp-web.js  

 Laravel WhatsApp: Send Messages via Meta Cloud API and whatsapp-web.js Behind One Facade 
==========================================================================================

     26 Jun 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   Overview  ](#overview)
2. [  02   Two Backends, One Facade  ](#two-backends-one-facade)
3. [  03   Sending Messages  ](#sending-messages)
4. [  04   Queued Sends and Inbound Events  ](#queued-sends-and-inbound-events)
5. [  05   Optional Admin UI and Persistence  ](#optional-admin-ui-and-persistence)
6. [  06   Getting Started  ](#getting-started)
7. [  07   Key Takeaways  ](#key-takeaways)

 Overview
--------

[Laravel WhatsApp](https://github.com/kstmostofa/laravel-whatsapp) is a package by Md Mostafijur Rahman that integrates WhatsApp messaging into Laravel applications. Its defining feature is a dual-backend architecture: Meta's official Cloud API for business messaging, and an unofficial Node-based [whatsapp-web.js](https://github.com/pedroslopez/whatsapp-web.js) sidecar that drives a headless Chromium instance to communicate via the WhatsApp Web protocol. Both backends sit behind the same `WhatsApp::` facade, so your application code stays consistent regardless of which transport is in use. The package supports Laravel 11, 12, and 13 on PHP 8.2 or higher.

Two Backends, One Facade
------------------------

The Cloud API and the web sidecar serve different use cases, and the package is transparent about the trade-offs:

| Capability | Cloud API | Web Sidecar | |---|---|---| | QR pairing | No | Yes | | Groups | No | Yes | | Free-form messaging | 24h template window | Yes | | Business templates | Yes | No | | Official support | Yes | Unofficial |

The Cloud API is the right choice for templated business messages with official backing. The web sidecar removes the 24-hour reply window restriction and adds group management and status updates, but it operates against a personal account without Meta's official support.

Sending Messages
----------------

Routing is determined by the recipient format. An E.164 phone number targets the Cloud API; a `@c.us` identifier targets the web sidecar:

```php
WhatsApp::send('+14155550123', 'Your order has shipped.');
WhatsApp::send('14155550123@c.us', 'Thanks for your message!');

```

For business templates, use the Cloud API's `sendTemplate` method directly:

```php
WhatsApp::messages()->sendTemplate('+14155550123', 'order_update', 'en_US', [
    ['type' => 'body', 'parameters' => [['type' => 'text', 'text' => 'Order #1042']]],
]);

```

The web sidecar supports named sessions, so you can run multiple personal accounts simultaneously:

```php
WhatsApp::web('main')->groups()->create('Team Leads', ['14155550123@c.us']);
WhatsApp::web('main')->messages()->sendImage('14155550123@c.us', [
    'url' => 'https://example.com/report.png',
    'caption' => 'Q2 summary'
]);

```

Queued Sends and Inbound Events
-------------------------------

Outbound messages can be dispatched as queued jobs to keep sending off the request cycle:

```php
SendMessage::dispatch('+14155550123', 'Your invoice is ready.');

```

Inbound messages from the sidecar are bridged into Laravel's event system via a long-running listener process. You subscribe to typed events like any other Laravel event:

```php
use \Kstmostofa\LaravelWhatsApp\Events\Web\MessageReceived;

Event::listen(MessageReceived::class, function ($event) {
    Log::info('Message received', ['from' => $event->from(), 'body' => $event->body()]);
});

```

Cloud API inbound traffic is handled through webhooks with HMAC signature verification using your Meta app secret.

Optional Admin UI and Persistence
---------------------------------

Installing the optional Livewire and Flux dependencies mounts an admin interface at `/whatsapp` with a dashboard, messaging screen, conversation views, and pages for groups, contacts, and webhook logs. Adding Laravel Reverb enables real-time conversation updates.

Persistence is opt-in via three Eloquent models — `WaSession`, `WaMessage`, and `WaContact` — which can be placed on a separate database connection to keep WhatsApp data isolated from your primary schema.

Getting Started
---------------

```bash
composer require kstmostofa/laravel-whatsapp
php artisan vendor:publish --tag=laravel-whatsapp-config
php artisan vendor:publish --tag=laravel-whatsapp-migrations
php artisan migrate

```

Add your Meta credentials to `.env` for the Cloud API path, then install and start the sidecar for the web backend:

```bash
php artisan whatsapp:sidecar:install
php artisan whatsapp:sidecar:start
php artisan whatsapp:web:listen main &

```

Key Takeaways
-------------

- A single `WhatsApp::` facade abstracts both the Meta Cloud API and the whatsapp-web.js sidecar.
- Recipient format (E.164 vs `@c.us`) determines which backend handles each message.
- The web sidecar supports groups, QR pairing, and free-form messaging; the Cloud API provides official business template support.
- Outbound messages can be queued; inbound sidecar messages fire typed Laravel events.
- An optional Livewire-based admin UI and opt-in Eloquent persistence layer are available.
- Requires Laravel 11–13 and PHP 8.2+.

---

*Source: [Laravel WhatsApp: Two Backends Behind One Facade — Laravel News](https://laravel-news.com/laravel-whatsapp-two-backends-behind-one-facade)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-whatsapp-send-messages-via-meta-cloud-api-and-whatsapp-webjs-behind-one-facade&text=Laravel+WhatsApp%3A+Send+Messages+via+Meta+Cloud+API+and+whatsapp-web.js+Behind+One+Facade) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-whatsapp-send-messages-via-meta-cloud-api-and-whatsapp-webjs-behind-one-facade) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  What is the difference between the Cloud API and the web sidecar in laravel-whatsapp?        The Cloud API is Meta's official channel for business messaging. It supports templated messages but restricts free-form replies to a 24-hour window and does not support groups. The web sidecar uses whatsapp-web.js with headless Chromium to connect via the WhatsApp Web protocol, enabling free-form messaging, group creation, and QR pairing, but it operates against a personal account without official Meta support. 

      Q02  How does laravel-whatsapp decide which backend to use when sending a message?        The recipient format determines the backend. Passing an E.164 phone number (e.g., '+14155550123') routes the message through the Cloud API. Passing a '@c.us' identifier (e.g., '14155550123@c.us') routes it through the web sidecar session. 

      Q03  Does laravel-whatsapp support receiving inbound WhatsApp messages?        Yes. Inbound messages from the web sidecar are bridged into Laravel's event system via a long-running 'whatsapp:web:listen' artisan process, firing typed events such as MessageReceived. Inbound Cloud API traffic is handled through webhooks with HMAC signature verification. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Laravel 13: New Features, Helpers, and Practical Upgrade Notes](https://cdn.msaied.com/339/58c4fa6fe9b6d25a2dac17c621b6f4c6.png) laravel laravel-13 upgrade 

### Laravel 13: New Features, Helpers, and Practical Upgrade Notes

Laravel 13 ships with async-first defaults, a leaner bootstrapping layer, and several quality-of-life helpers....

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-13-new-features-helpers-and-practical-upgrade-notes) [ ![Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping](https://cdn.msaied.com/337/05b39d16d0f88a5fb94d0cf74049b88b.png) laravel laravel-12 upgrade 

### Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping

Laravel 12 ships with a leaner skeleton, first-class route file organisation, and a revised application bootst...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-12-structured-route-files-slim-skeletons-and-the-new-application-bootstrapping) [ ![Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning](https://cdn.msaied.com/336/89d518450335e8fcdaa5be882cf4dd3e.png) laravel api resources 

### Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning

Go beyond basic API resources. Learn how to implement sparse fieldsets, conditionally load relationships, and...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-api-resources-sparse-fieldsets-conditional-relationships-and-versioning) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
