# WhatsApp Gateway

Gateway Node lokal untuk memproses `notification_jobs` dari app PHP.

## Endpoint

- `GET /health`
- `GET /session`
- `GET /session/qr`
- `POST /messages/send`

## Request `POST /messages/send`

```json
{
  "job_id": 123,
  "phone": "6281234567890",
  "message": "Halo Kak...",
  "meta": {
    "spk_id": 10
  }
}
```

## Response sukses

```json
{
  "ok": true,
  "data": {
    "provider": "baileys",
    "provider_message_id": "ABCD1234",
    "accepted_at": "2026-04-29T13:00:00.000Z"
  }
}
```

## Menjalankan

1. Salin `.env.example` menjadi `.env`
2. Install dependency:
   `npm install`
3. Jalankan gateway:
   `npm start`
4. Jalankan worker PHP:
   `php scripts/run_notification_worker.php --mode=gateway --limit=20`

## Environment app PHP

Tambahkan pada `.env` app PHP:

```dotenv
WA_GATEWAY_URL=http://127.0.0.1:3010
WA_GATEWAY_TOKEN=
WA_GATEWAY_TIMEOUT_MS=15000
```
