Enterprise WhatsApp Middleware — Dokumentasi Endpoint
/api/v1/messages/send
Kirim pesan teks / media / lokasi / AI
Content-Type: application/json
Auth: Wajib menyertakan app_id dan secret_key di body request.
Session: Device WhatsApp dikonfigurasi per-aplikasi di panel API Keys — tidak perlu dikirim di request.
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
| app_id | string | Ya | App ID dari panel API Keys |
| secret_key | string | Ya | Secret Key dari panel API Keys |
| to | string | Ya | Nomor personal: 628xxx atau 628xxx@c.us — Grup: 628xxx-xxx@g.us |
| content | object | Opsional* | Objek isi pesan. Minimal salah satu: text, raw_data, atau file. Tidak diperlukan jika type = location |
| content.text | string | Opsional | Isi pesan teks / caption media |
| content.raw_data | object/string | Opsional | Data mentah untuk AI (gunakan bersama use_ai: true) |
| content.file | object | Opsional* | Wajib jika type = image/file. Isi: url, mimetype, filename |
| type | string | Opsional | text (default), image, file, document, location |
| location | object | Opsional* | Wajib jika type = location. Isi: latitude (number), longitude (number), title (string, opsional) |
| location.latitude | number | Opsional* | Koordinat lintang (misal: -6.2088 untuk Jakarta) |
| location.longitude | number | Opsional* | Koordinat bujur (misal: 106.8456 untuk Jakarta) |
| location.title | string | Opsional | Label nama lokasi yang tampil di atas pin maps |
| priority | string | Opsional | high, normal (default), low |
| use_ai | boolean | Opsional | Aktifkan Gemini AI untuk menyusun ulang pesan |
| ai_context | string | Opsional | Instruksi khusus untuk AI |
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890",
"content": {
"text": "Halo! Ini notifikasi dari sistem kami."
}
}
ID grup format nomor-timestamp@g.us — lihat di Device → Detail Device.
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890-1600000000@g.us",
"content": {
"text": "Pengumuman: Meeting pukul 15.00 WIB hari ini."
}
}
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890",
"use_ai": true,
"ai_context": "Ubah data absensi ini menjadi laporan harian yang ramah untuk tim HR.",
"content": {
"raw_data": {
"tanggal": "1 Juni 2026",
"hadir": 92,
"sakit": 5,
"izin": 3
}
}
}
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890",
"type": "image",
"content": {
"text": "Dokumentasi kegiatan lapangan hari ini.",
"file": {
"url": "https://domain.com/uploads/foto.jpg",
"mimetype": "image/jpeg",
"filename": "foto-lapangan.jpg"
}
}
}
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890",
"type": "file",
"content": {
"text": "Terlampir laporan keuangan bulan Mei 2026.",
"file": {
"url": "https://domain.com/files/laporan.pdf",
"mimetype": "application/pdf",
"filename": "laporan-mei-2026.pdf"
}
}
}
Muncul sebagai pin maps interaktif di WhatsApp — bisa langsung dibuka di Google Maps. Cocok untuk laporan posisi tim lapangan.
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890",
"type": "location",
"location": {
"latitude": -6.208763,
"longitude": 106.845599,
"title": "Lokasi Tim A — Proyek Sudirman"
}
}
Tip: Koordinat GPS bisa diambil otomatis dari aplikasi mobile (navigator.geolocation di browser atau GPS di Android/iOS).
{
"app_id": "app_abc123",
"secret_key": "secretkeyanda...",
"to": "6281234567890-1600000000@g.us",
"type": "image",
"use_ai": true,
"ai_context": "Buatkan caption foto kegiatan yang semangat untuk tim sales.",
"content": {
"raw_data": "Pameran Jakarta sukses, pengunjung melebihi target 120%",
"file": {
"url": "https://domain.com/pameran.jpg",
"mimetype": "image/jpeg",
"filename": "pameran-jkt.jpg"
}
}
}
✅ Sukses (200)
// Pesan teks/media:
{
"success": true,
"message": "Pesan berhasil dimasukkan ke antrean",
"jobId": "5",
"app": "HRIS System",
"session": "NOEMesenger",
"recipient": "6281234567890@c.us",
"type": "text"
}
// Lokasi (type: location):
{
"success": true,
"message": "Pesan berhasil dimasukkan ke antrean",
"jobId": "6",
"app": "Field Report App",
"session": "NOEMesenger",
"recipient": "6281234567890@c.us",
"type": "location",
"location": {
"latitude": -6.208763,
"longitude": 106.845599,
"title": "Lokasi Tim A"
}
}
❌ Error (400 / 401 / 403)
{
"error": "Deskripsi pesan error"
}
// Contoh:
// 401 app_id dan secret_key wajib disertakan
// 401 secret_key tidak valid
// 403 Aplikasi ini sedang dinonaktifkan
// 400 content harus memiliki minimal
// salah satu: text, raw_data, atau file
// 400 Aplikasi belum memiliki device/session
<?php
use Illuminate\Support\Facades\Http;
$response = Http::post('http://SERVER_IP:4000/api/v1/messages/send', [
'app_id' => 'app_abc123',
'secret_key' => 'secretkeyanda...',
'to' => '6281234567890',
'use_ai' => true,
'ai_context' => 'Buat notifikasi yang ramah untuk pengguna.',
'content' => [
'raw_data' => [
'nama' => 'Budi Santoso',
'status' => 'Pesanan dikonfirmasi',
'total' => 'Rp 250.000',
]
]
]);
$data = $response->json();
// $data['jobId'] — ID job untuk tracking status
?>
⚠ Catatan Penting
\n untuk baris baru dalam string JSON, bukan enter langsung.WhatsHub — Developed by Noesantara Inti Solusi © 2026