Skip to content

Laravel WhatsAppWhatsApp messaging for Laravel apps

Send messages and templates, receive webhooks as events, and send notifications on a whatsapp channel, using Meta's WhatsApp Business Cloud API.

Laravel WhatsApp

What it looks like

Send a message from anywhere in your app:

php
use Crenspire\Whatsapp\Facades\Whatsapp;

Whatsapp::sendTextMessage('15551234567', 'Your order has shipped.');

Whatsapp::sendTemplateMessage('15551234567', 'order_shipped', ['Sarah', '#1042']);

Or send it as a notification:

php
class OrderShipped extends Notification
{
    public function __construct(public Order $order) {}

    public function via(object $notifiable): array
    {
        return ['whatsapp'];
    }

    public function toWhatsapp(object $notifiable): WhatsappMessage
    {
        return WhatsappMessage::template('order_shipped', [$notifiable->name, $this->order->number]);
    }
}

And reply to customers from an event listener:

php
Event::listen(function (MessageReceived $event) {
    if ($event->text() === 'status') {
        Whatsapp::showTypingIndicator($event->messageId);
        Whatsapp::sendTextMessage($event->from, 'Your order ships today.', replyTo: $event->messageId);
    }
});

Requires PHP 8.2+ and Laravel 12 or 13. Install it in a few minutes →

Released under the MIT License. Not affiliated with Meta or WhatsApp.