PHPackages                             wawabot/laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. wawabot/laravel

ActiveLibrary[API Development](/categories/api)

wawabot/laravel
===============

Laravel package untuk kirim pesan WhatsApp via WaWaBot API

v1.0.2(2w ago)07MITPHPPHP ^8.1

Since May 16Pushed 2w agoCompare

[ Source](https://github.com/sikuning/WaWaBot)[ Packagist](https://packagist.org/packages/wawabot/laravel)[ Docs](https://github.com/sikuning/WaWaBot)[ RSS](/packages/wawabot-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

WaWaBot Laravel
===============

[](#wawabot-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6349a0aa595d38789d57d2e14bf4642a54b953f549cbe9a75ee3e4233f11bfc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77617761626f742f6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wawabot/laravel)[![Total Downloads](https://camo.githubusercontent.com/391c81bd54fac72ec993f65e2b316c893500b05ad878c56cd349b663e5c59392/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77617761626f742f6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wawabot/laravel)[![License](https://camo.githubusercontent.com/9255ccd75403562b59d8e4494ad78db001bcec6756db9a6a6dfe2f255cfb5302/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77617761626f742f6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wawabot/laravel)

Package Laravel untuk mengirim pesan WhatsApp melalui [WaWaBot API](https://wa-api.wawabot.id). Cukup install package ini, set `api_key` dan `account_id`, lalu panggil method untuk kirim teks, gambar, atau kelola sesi WhatsApp.

- **Packagist:** [packagist.org/packages/wawabot/laravel](https://packagist.org/packages/wawabot/laravel)
- **GitHub:** [github.com/sikuning/WaWaBot](https://github.com/sikuning/WaWaBot)

Persyaratan
-----------

[](#persyaratan)

- PHP 8.1+
- Laravel 10, 11, atau 12

Instalasi
---------

[](#instalasi)

Masuk ke folder project Laravel Anda, lalu jalankan:

```
composer require wawabot/laravel
```

Tidak perlu menambah `repositories` di `composer.json` — package sudah tersedia di [Packagist](https://packagist.org/packages/wawabot/laravel).

Laravel akan otomatis mendeteksi `WaWaBotServiceProvider` lewat auto-discovery.

### Publish config (opsional)

[](#publish-config-opsional)

```
php artisan vendor:publish --tag=wawabot-config
```

File config akan tersedia di `config/wawabot.php`.

### Set environment variables

[](#set-environment-variables)

Tambahkan ke file `.env`:

```
WAWABOT_BASE_URL=https://wa-api.wawabot.id
WAWABOT_API_KEY=api-key-dari-penyedia-layanan
WAWABOT_ACCOUNT_ID=user-1
```

VariabelKeterangan`WAWABOT_BASE_URL`Base URL API (default: `https://wa-api.wawabot.id`)`WAWABOT_API_KEY`API key dari penyedia layanan`WAWABOT_ACCOUNT_ID`ID akun WhatsApp Anda (contoh: `user-1`)### Instalasi alternatif (development)

[](#instalasi-alternatif-development)

Install dari folder lokal atau GitHub (tanpa Packagist)**Folder lokal** — untuk develop package sebelum publish:

```
{
  "repositories": [
    {
      "type": "path",
      "url": "../WaWaBot-Laravel",
      "options": { "symlink": true }
    }
  ],
  "require": {
    "wawabot/laravel": "@dev"
  }
}
```

**Langsung dari GitHub** — jika perlu versi `dev-main` sebelum rilis di Packagist:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/sikuning/WaWaBot.git"
    }
  ],
  "require": {
    "wawabot/laravel": "dev-main"
  }
}
```

---

Alur penggunaan (pertama kali)
------------------------------

[](#alur-penggunaan-pertama-kali)

Sebelum bisa kirim pesan, akun WhatsApp harus ditautkan lewat QR code:

1. **Start sesi** — `start()`
2. **Ambil QR** — `qr()`, tampilkan ke user (browser/API)
3. **Scan di HP** — Buka WhatsApp → **Pengaturan** (ikon roda gigi) → **Perangkat tertaut** → **Tautkan perangkat** → arahkan kamera ke QR
4. **Cek status login** — `infoMe()` atau `session()`
5. **Kirim pesan** — `send()` atau `sendMedia()`

---

Penggunaan
----------

[](#penggunaan)

### Via Facade (menggunakan config `.env`)

[](#via-facade-menggunakan-config-env)

```
use WaWaBot\Facades\WaWaBot;

// Kirim teks
WaWaBot::send('6281234567890', 'Halo dari Laravel!');

// Kirim gambar
WaWaBot::sendMedia(
    to: '6281234567890',
    filePath: storage_path('app/public/foto.jpg'),
    caption: 'Ini caption gambar',
);
```

### Via dependency injection

[](#via-dependency-injection)

```
use WaWaBot\WaWaBot;

class NotificationController extends Controller
{
    public function __construct(private WaWaBot $waWaBot) {}

    public function sendWelcome(string $phone): array
    {
        return $this->waWaBot->send($phone, 'Selamat datang!');
    }
}
```

### Instansiasi manual (multi akun / tanpa `.env`)

[](#instansiasi-manual-multi-akun--tanpa-env)

Berguna jika satu aplikasi mengelola beberapa akun WhatsApp:

```
use WaWaBot\WaWaBot;

$bot = new WaWaBot(
    apiKey: 'api-key-anda',
    accountId: 'user-1',
    baseUrl: 'https://wa-api.wawabot.id', // opsional, ini default-nya
);

$bot->send('6281234567890', 'Pesan dari akun user-1');
```

---

Contoh lengkap: dari pairing sampai kirim pesan
-----------------------------------------------

[](#contoh-lengkap-dari-pairing-sampai-kirim-pesan)

```
use WaWaBot\Facades\WaWaBot;
use WaWaBot\Exceptions\WaWaBotException;

try {
    // 1. Mulai sesi akun
    WaWaBot::start();

    // 2. Ambil QR (JSON — untuk ditampilkan di frontend)
    $qrData = WaWaBot::qr();
    // $qrData berisi response JSON dari API (mis. data QR base64)

    // Atau ambil sebagai HTML (untuk langsung render di browser)
    // $qrHtml = WaWaBot::qr(isHtml: true);

    // 3. Setelah user scan QR di HP, cek status login
    $info = WaWaBot::infoMe();
    $session = WaWaBot::session();

    // 4. Kirim pesan teks
    $result = WaWaBot::send('6281234567890', 'Halo, ini pesan teks!');

    // 5. Kirim gambar / media
    $mediaResult = WaWaBot::sendMedia(
        to: '6281234567890',
        filePath: public_path('images/promo.jpg'),
        caption: 'Promo bulan ini!',
    );

    // 6. (Opsional) Cek apakah nomor terdaftar di WhatsApp
    $lookup = WaWaBot::lookup('085612312311');

} catch (WaWaBotException $e) {
    // Handle error dari API
    logger()->error('WaWaBot error', [
        'message' => $e->getMessage(),
        'status' => $e->getCode(),
        'body' => $e->response?->json(),
    ]);
}
```

---

Daftar method
-------------

[](#daftar-method)

MethodHTTPEndpointDeskripsi`start()``POST``/accounts/{id}/start`Memulai sesi akun`session()``GET``/accounts/{id}/session`Status sesi akun`qr($isHtml)``GET``/accounts/{id}/qr`Ambil QR code untuk scan`infoMe()``GET``/info-me`Cek nomor &amp; status login`send($to, $text)``POST``/accounts/{id}/send`Kirim pesan teks`sendMedia($to, $path, $caption)``POST``/accounts/{id}/send-media`Kirim gambar/file`lookup($to)``GET``/accounts/{id}/lookup`Cek nomor WhatsApp`logout()``POST``/accounts/{id}/logout`Logout / putus sesiSemua request mengirim header:

```
x-api-key: {api_key}
accept: application/json

```

### Parameter `send()`

[](#parameter-send)

```
WaWaBot::send(
    to: '6281234567890',  // nomor tujuan (format internasional disarankan)
    text: 'Isi pesan',
);
```

### Parameter `sendMedia()`

[](#parameter-sendmedia)

```
WaWaBot::sendMedia(
    to: '6281234567890',
    filePath: '/path/ke/gambar.jpg',  // path file lokal yang bisa dibaca
    caption: 'Caption opsional',       // boleh null
);
```

Format file mengikuti dukungan API (jpeg, png, pdf, dll.).

### Parameter `qr()`

[](#parameter-qr)

```
// Response JSON (default)
$data = WaWaBot::qr();

// Response HTML mentah (untuk embed di halaman web)
$html = WaWaBot::qr(isHtml: true);
```

---

Penanganan error
----------------

[](#penanganan-error)

Jika API mengembalikan status error (4xx/5xx), package akan melempar `WaWaBot\Exceptions\WaWaBotException`:

```
use WaWaBot\Exceptions\WaWaBotException;

try {
    WaWaBot::send('6281234567890', 'Halo');
} catch (WaWaBotException $e) {
    echo $e->getMessage();           // pesan error
    echo $e->getCode();              // HTTP status code
    $e->response?->json();           // body response lengkap
    $e->response?->body();           // raw body
}
```

---

Development &amp; testing
-------------------------

[](#development--testing)

Clone repository:

```
# SSH
git clone git@github.com:sikuning/WaWaBot.git

# atau HTTPS
git clone https://github.com/sikuning/WaWaBot.git

cd WaWaBot
composer install
./vendor/bin/phpunit
```

---

Lisensi
-------

[](#lisensi)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance96

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

19d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a6c8a9f4df4c276dcc91992b38b1a38d342195ce11a7d9845adecda0705828f?d=identicon)[robbie](/maintainers/robbie)

---

Tags

laravelwhatsappwawabot

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wawabot-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/wawabot-laravel/health.svg)](https://phpackages.com/packages/wawabot-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76318.2M110](/packages/laravel-mcp)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
