Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Whatsapp Laravel Package

kstmostofa/laravel-whatsapp

Laravel package to send WhatsApp messages from your app. Provides a simple API to configure credentials and dispatch messages (often via popular gateways like Twilio) with easy setup for notifications and custom message templates.

View on GitHub
Deep Wiki
Context7

Laravel WhatsApp

Latest Version PHP Version License

Dual-backend WhatsApp integration for Laravel β€” Meta Cloud API (pure PHP) + whatsapp-web.js sidecar (full personal-account access), with a polished Livewire admin UI and a single WhatsApp:: facade across both.

πŸ“– Full documentation: kstmostofa.github.io/laravel-whatsapp


What you get

Layer What it does
Cloud API client Pure PHP. Templates, media, business profile, phone-number management, webhooks with HMAC verification.
Web sidecar (~300 LOC Node) whatsapp-web.js wrapped in a thin HTTP service. Personal-number QR pairing, groups, status, free-form messages anytime, contact lookup.
Unified facade WhatsApp::messages()->sendTemplate(...) for Cloud, WhatsApp::web('main')->messages()->sendText(...) for sidecar. WhatsApp::send($to, $body) auto-picks.
Livewire + Flux UI Drop-in admin at /whatsapp β€” Dashboard, Sessions+QR, Compose, Conversations (chat-bubble UI with media, edit/delete, search, sound, ack ticks), Groups, Contacts, Webhooks log, Status. Works with Tailwind, Bootstrap, or no CSS framework at all.
Eloquent models Opt-in WaSession / WaMessage / WaContact with separate-DB support via WHATSAPP_DB_CONNECTION.
Background bridge whatsapp:web:listen daemon turns sidecar SSE events into Laravel events.
Health monitoring WhatsApp::status page + php artisan whatsapp:health [--json] for CI/monitoring.

Quick install

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

For the Cloud API β€” set in .env:

WHATSAPP_ACCESS_TOKEN=EAAG...permanent-token
WHATSAPP_PHONE_NUMBER_ID=123456789012345
WHATSAPP_BUSINESS_ACCOUNT_ID=987654321098765
WHATSAPP_APP_SECRET=your-meta-app-secret
WHATSAPP_VERIFY_TOKEN=any-string-you-make-up

For the Web sidecar β€” pair your phone:

composer require livewire/livewire livewire/flux           # for the UI
php artisan whatsapp:sidecar:install                       # one-time, ~600 MB Chrome download
php artisan whatsapp:sidecar:start                         # boots in background
php artisan whatsapp:web:listen main &                     # SSE β†’ Laravel events (run under Supervisor in prod)
# Open http://your-app.test/whatsapp/sessions and click "Start" β†’ scan QR with your phone

Quick example

use Kstmostofa\LaravelWhatsApp\Facades\WhatsApp;
use Kstmostofa\LaravelWhatsApp\Jobs\SendMessage;

// One-line send β€” picks backend by recipient shape
WhatsApp::send('+9665XXXXXXXX', 'Hello from Laravel');           // β†’ Cloud API
WhatsApp::send('966512345678@c.us', 'Hello via personal number'); // β†’ Web sidecar

// Templated business message (Cloud API)
WhatsApp::messages()->sendTemplate('+9665XXXXXXXX', 'order_ready', 'en_US', [
    ['type' => 'body', 'parameters' => [['type' => 'text', 'text' => 'Munir']]],
]);

// Personal-number flow (Web sidecar β€” works for any chat your paired phone can see)
WhatsApp::web('main')->groups()->create('Project X', ['9665XXXXXXXX@c.us']);
WhatsApp::web('main')->messages()->sendImage('9665XXXXXXXX@c.us', ['url' => 'https://…/photo.jpg', 'caption' => 'Hi']);

// Or queue it
SendMessage::dispatch('+9665XXXXXXXX', 'Queued hello');

// Inbound β€” listen via Laravel events
Event::listen(\Kstmostofa\LaravelWhatsApp\Events\Web\MessageReceived::class, function ($event) {
    Log::info('Got message', ['from' => $event->from(), 'body' => $event->body()]);
});

When to use which backend

Feature Cloud API Web sidecar
Personal-number QR pairing ❌ βœ…
Send to / receive from groups ❌ βœ…
Status / Stories ❌ βœ…
Free-form messages anytime ❌ (templates outside 24h) βœ…
Approved business templates βœ… ❌
Official, no ban risk βœ… ❌ (browser automation β€” ToS gray area)
Scalable to millions βœ… ⚠️ session-bound
No extra runtime on host βœ… ❌ (Node + Chromium)

Most apps use both β€” Cloud API for transactional/template sends at scale, Web sidecar for the features Cloud API doesn't expose.

UI install paths

The admin UI under /whatsapp works on whatever your app already uses:

Your app uses… Set in .env What you get
Tailwind v4 + Vite WHATSAPP_UI_CSS_MODE=vite (default) Smallest tree-shaken bundle. Add 3 @source lines to your app.css.
Anything else (Tailwind v3 / Bootstrap / plain CSS / nothing) WHATSAPP_UI_CSS_MODE=standalone Pre-compiled CSS shipped with the package, served from /whatsapp/_assets/laravel-whatsapp.css (~32 KB gz). No npm/Tailwind needed. Loads only on /whatsapp/* pages β€” your main app stays untouched.
No UI at all skip composer require livewire/flux Headless. Full access to WhatsApp:: facade, Events, Jobs, webhook receiver, all CLI commands.

Full setup details + dark mode + screenshots β†’ docs site.

Artisan commands

Command Purpose
whatsapp:sidecar:install Clone whatsapp-web.js, npm ci, download Chromium
whatsapp:sidecar:start / :stop / :status Lifecycle of the Node process
whatsapp:web:listen [session] Long-running: sidecar SSE β†’ Laravel events
whatsapp:health [--json] [--exit-code] Health probe β€” pipe into cron / monitoring

Production checklist

  • Set strong WHATSAPP_WEB_TOKEN (shared secret between PHP and sidecar)
  • Set WHATSAPP_APP_SECRET (HMAC for Cloud webhook signatures)
  • Wrap /whatsapp/* routes in your own auth middleware: config/laravel-whatsapp.php β†’ ui.middleware
  • Run whatsapp:web:listen under Supervisor / systemd, one process per session
  • Optional: isolate WA data on a separate DB connection (WHATSAPP_DB_CONNECTION=whatsapp)
  • Optional: enable broadcasting (WHATSAPP_BROADCAST=true) + run Laravel Reverb for instant UI updates

Detailed deployment guide β†’ docs/production.

Roadmap

  • Cloud API: messages / templates / media / business profile / phone numbers / webhooks
  • Web sidecar: full whatsapp-web.js surface (text, media, groups, contacts, status)
  • Livewire + Flux admin UI with dark mode, 3 CSS install paths
  • Eloquent persistence with per-package DB connection
  • Health page + CLI command + cached snapshots
  • Avatar + media proxy with server-side caching
  • Bubble actions: edit, delete-for-me, delete-for-everyone, "you deleted this message" placeholder
  • Bulk send job with rate limiting
  • Native broadcasting integration with Echo channel listeners
  • Template builder UI (currently API-only)

Status

  • 46 tests passing, 133 assertions (testbench + mocked Guzzle + Livewire smoke tests)
  • Compatible with Laravel 11 / 12 / 13 β€” tests run green against L13.11 + PHPUnit 12 on PHP 8.5
  • PHP minimum: 8.2 on Laravel 11/12, 8.4 on Laravel 13 (Symfony 8 transitive)
  • Verified end-to-end in Laravel 12: QR pairing, inbound webhook β†’ DB β†’ UI bubble, edit, delete, sound, attachments, dark-mode toggle

License

MIT. See LICENSE.

Contributing

Issues + PRs welcome at github.com/kstmostofa/laravel-whatsapp. Please run vendor/bin/phpunit locally before submitting.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky