junandia / larawaba
Simple WhatsApp Business SDK for Laravel applications.
Requires
- php: ^8.1
- illuminate/http: ^9.0|^10.0|^11.0
- illuminate/routing: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
README
English
Larawaba is a lightweight and efficient Laravel SDK for interacting with the WhatsApp Business Cloud API (Meta). Designed for ease of use with auto-discovery features, automatic webhook management, and an event-driven architecture.
Features
- Zero Config Webhook: Automatic verification and webhook handler.
- Event-Driven: Uses Laravel Event
MessageReceivedto process incoming messages. - Fluent Messaging: Send text messages with a single line of code.
- Auto-Discovery: Automatically registered in your Laravel application.
Installation
composer require junandia/larawaba
Configuration
Add your credentials to your .env file:
WABA_TOKEN=your-meta-access-token WABA_PHONE_ID=your-phone-number-id WABA_VERIFY_TOKEN=your-custom-verify-token WABA_GRAPH_VERSION=v20.0
Usage
1. Sending Messages
use Junandia\Larawaba\WhatsAppClient; $wa = app(WhatsAppClient::class); $wa->sendText('628123456789', 'Hello from Larawaba SDK!');
2. Handling Incoming Messages (Listener)
Register the listener in AppServiceProvider.php:
use Junandia\Larawaba\Events\MessageReceived; use App\Listeners\ProcessWhatsAppMessage; use Illuminate\Support\Facades\Event; Event::listen(MessageReceived::class, ProcessWhatsAppMessage::class);
Bahasa Indonesia
Larawaba adalah SDK Laravel yang ringan dan efisien untuk berinteraksi dengan WhatsApp Business Cloud API (Meta). Didesain untuk kemudahan penggunaan dengan fitur auto-discovery, manajemen webhook otomatis, dan arsitektur berbasis event.
Fitur Utama
- Zero Config Webhook: Verifikasi dan handler webhook otomatis.
- Event-Driven: Menggunakan Event Laravel
MessageReceiveduntuk memproses pesan masuk. - Fluent Messaging: Kirim pesan teks hanya dengan satu baris kode.
- Auto-Discovery: Otomatis terdaftar di aplikasi Laravel Anda.
Instalasi
composer require junandia/larawaba
Konfigurasi
Tambahkan kredensial WhatsApp Business Anda ke dalam file .env:
WABA_TOKEN=token-akses-meta-anda WABA_PHONE_ID=id-nomor-telepon-anda WABA_VERIFY_TOKEN=token-verifikasi-custom-anda WABA_GRAPH_VERSION=v20.0
Penggunaan
1. Mengirim Pesan
use Junandia\Larawaba\WhatsAppClient; $wa = app(WhatsAppClient::class); $wa->sendText('628123456789', 'Halo dari Larawaba SDK!');
2. Menangani Pesan Masuk (Listener)
Daftarkan listener di AppServiceProvider.php:
use Junandia\Larawaba\Events\MessageReceived; use App\Listeners\ProcessWhatsAppMessage; use Illuminate\Support\Facades\Event; Event::listen(MessageReceived::class, ProcessWhatsAppMessage::class);
License
The MIT License (MIT). See LICENSE for more information.