@extends('root') @section('title', 'API Documentation') @section('content')
Dokumentasi lengkap API khusus untuk Client. Endpoint untuk mengirim pesan, mengelola dedicated number, dan billing.
API ini digunakan oleh Client untuk mengirim pesan WhatsApp, mengelola dedicated number, melihat statistik penggunaan, dan melakukan topup saldo.
{{ url('/api') }}X-Api-Key: Bearer {your_client_api_key}
Content-Type: application/json
API Key dapat dilihat di Panel → Settings → API Settings
curl -X GET {{ url('/api/v1/balance') }} \
-H "X-Api-Key: Bearer your_api_key_here" \
-H "Content-Type: application/json"
Deskripsi: Kirim pesan WhatsApp menggunakan template yang sudah APPROVED
{
"name_template": "welcome_message",
"phone_number": "628111223344",
"language_code": "id",
"body_params": ["Budi", "INV-123"],
"header_params": ["Promo Akhir Tahun"],
"header_media_url": "https://example.com/image.jpg",
"button_params": {
"0": ["tracking123"]
}
}
| Field | Type | Required | Deskripsi |
|---|---|---|---|
name_template |
string | Ya | Nama template yang sudah APPROVED |
phone_number |
string | Ya | Nomor telepon internasional (format: 628xxx) |
language_code |
string | Tidak | Kode bahasa template (id, en, dll). Untuk filter jika ada template dengan nama sama tapi beda bahasa. |
body_params |
array | Tidak | Array string untuk placeholder body template. Contoh: ["Budi", "INV-123"] |
header_params |
array | Tidak | Array string untuk placeholder header text. Contoh: ["Promo 50%"] |
header_media_url |
string (URL) | Tidak | URL publik untuk header media (gambar/video/dokumen). Gunakan ini jika header template adalah media. |
button_params |
object | Tidak | Object dengan key = index button, value = array parameter. Contoh: {"0": ["tracking123"]} |
{
"status": "success",
"message_id": "uuid-xxx-xxx",
"price": 350,
"template": "welcome_message",
"type": "Marketing"
}
{
"status": "error",
"message": "Template tidak ditemukan atau belum approved"
}
{
"status": "error",
"message": "Template tidak tersedia untuk client ini"
}
{
"status": "error",
"message": "Error message from Meta API",
"error_code": "131030",
"raw_error": "(#131030) ..."
}
<?php
$apiKey = 'YOUR_API_KEY';
$url = '{{ url('/api/v1/send-template') }}';
$data = [
'name_template' => 'welcome_message',
'phone_number' => '628111223344',
'body_params' => ['Budi', 'INV-123'],
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-KEY:Bearer ' . $apiKey,
],
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
if ($result['status'] === 'success') {
echo "Message ID: " . $result['message_id'];
} else {
echo "Error: " . $result['message'];
}
Deskripsi: Melihat daftar nomor dedicated yang tersedia untuk di-request
{
"status": true,
"message": "Available numbers retrieved",
"data": [
{
"id": 1,
"phone_number": "628123456789",
"account_name": "Business Account 1",
"base_price": 500000,
"margin": 50000,
"total_price": 550000,
"formatted_price": "Rp 550.000"
}
]
}
Deskripsi: Request assign nomor dedicated. Saldo dikurangi saat disetujui
{
"waba_pool_id": 1,
"label": "Nomor CS Utama"
}
{
"status": true,
"message": "Request berhasil dikirim. Menunggu persetujuan admin.",
"data": {
"request_id": 15,
"waba_pool_id": 1,
"phone_number": "628123456789",
"status": "pending",
"total_price": 550000
}
}
{
"status": false,
"message": "Saldo tidak mencukupi. Dibutuhkan Rp 550.000",
"error_code": "INSUFFICIENT_BALANCE"
}
Deskripsi: Melihat nomor dedicated milik Anda yang sudah aktif
{
"status": true,
"data": [
{
"id": 1,
"waba_pool_id": 5,
"phone_number": "628123456789",
"label": "Nomor CS Utama",
"status": "active",
"price": 550000,
"assigned_at": "2025-12-01T10:00:00Z"
}
]
}
Deskripsi: Request ganti nama/label nomor dedicated
{
"dedicated_assign_id": 1,
"new_name": "Hotline Support 24 Jam"
}
{
"status": true,
"message": "Request ganti nama berhasil dikirim. Menunggu persetujuan admin.",
"data": {
"id": 5,
"current_name": "Nomor CS Utama",
"requested_name": "Hotline Support 24 Jam",
"status": "pending"
}
}
Deskripsi: Melihat daftar request ganti nama Anda
Deskripsi: Membatalkan request ganti nama yang masih pending
Deskripsi: Melihat saldo dan informasi akun
{
"status": true,
"data": {
"balance": 1500000,
"formatted_balance": "Rp 1.500.000",
"currency": "IDR",
"messages_today": 150,
"messages_this_month": 4500
}
}
Jika Anda mengalami kendala saat integrasi, hubungi tim support kami.
Hubungi Support