Laravel WhatsApp Package: Cloud API &amp; Web Sidecar | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Laravel WhatsApp: Send Messages via Meta Cloud API and whatsapp-web.js Behind One Facade

   [Laravel](https://www.msaied.com/public/articles?category=laravel) [Composer Pacakge](https://www.msaied.com/public/articles?category=composer-pacakge) 

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

 The laravel-whatsapp package lets you send and receive WhatsApp messages through Meta's official Cloud API or an unofficial whatsapp-web.js sidecar — both accessible through a single WhatsApp:: facade.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 26 Jun 2026 · Updated 29 Jun 2026 · 4 min read

ShareCopy linkCopied

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

  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)

 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)*

- [Laravel](https://www.msaied.com/public/articles?search=Laravel)
- [WhatsApp](https://www.msaied.com/public/articles?search=WhatsApp)
- [Composer Package](https://www.msaied.com/public/articles?search=Composer%20Package)
- [Meta Cloud API](https://www.msaied.com/public/articles?search=Meta%20Cloud%20API)
- [whatsapp-web.js](https://www.msaied.com/public/articles?search=whatsapp-web.js)

 Frequently asked questions 
---------------------------

  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.

   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.

   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.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

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

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleLaravel Service Container: Contextual Binding, Tagging, and Method Injection](https://www.msaied.com/public/articles/laravel-service-container-contextual-binding-tagging-and-method-injection-1) [Next articleUSAIGE: Track Token Usage and Costs for Laravel AI SDK Requests](https://www.msaied.com/public/articles/usaige-track-token-usage-and-costs-for-laravel-ai-sdk-requests)  

   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)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
