API Akun WhatsApp
API Status koneksi WhatsApp
Periksa apakah salah satu nomor WhatsApp Anda terhubung dan siap mengirim pesan. Gunakan sebelum kampanye, atau saat menunggu nomor yang baru dihubungkan selesai ditautkan. Gunakan endpoint ini, bukan /api/v1/whatsapp/status/<id>/ yang tidak berfungsi.
https://wbiztool.com/api/v1/whatsapp-client/status/Body: JSON atau field formulir
Contoh singkat#
curl -X POST https://wbiztool.com/api/v1/whatsapp-client/status/ \
-H "Content-Type: application/json" \
-d '{
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"whatsapp_client": 678
}'import requests
response = requests.post(
"https://wbiztool.com/api/v1/whatsapp-client/status/",
json={
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"whatsapp_client": 678,
},
timeout=30,
)
result = response.json() # read the body even when the HTTP code is 400 or 403
if result["status"] == 1:
print("Connected")
elif result["message"] == "Disconnected":
print("Not connected. Reconnect it in WhatsApp settings.")
else:
print("Failed:", result["message"])// Node.js 18+ (built-in fetch). Save as .mjs to use top-level await.
const response = await fetch("https://wbiztool.com/api/v1/whatsapp-client/status/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
client_id: 12345,
api_key: "YOUR_API_KEY",
whatsapp_client: 678,
}),
});
const result = await response.json(); // read the body even when the HTTP code is 400 or 403
if (result.status === 1) {
console.log("Connected");
} else if (result.message === "Disconnected") {
console.log("Not connected. Reconnect it in WhatsApp settings.");
} else {
console.error("Failed:", result.message);
}<?php
$payload = [
'client_id' => 12345,
'api_key' => 'YOUR_API_KEY',
'whatsapp_client' => 678,
];
$ch = curl_init('https://wbiztool.com/api/v1/whatsapp-client/status/');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($result['status'] ?? 0) === 1) {
echo 'Connected';
} elseif (($result['message'] ?? '') === 'Disconnected') {
echo 'Not connected. Reconnect it in WhatsApp settings.';
} else {
echo 'Failed: ' . ($result['message'] ?? 'no response');
}Ganti 12345, YOUR_API_KEY, dan 678 dengan nilai Anda sendiri. Lihat Autentikasi untuk mengetahui di mana menemukannya.
Parameter request#
client_idintegerwajibAPI Client ID Anda dari Settings → API keys (Pengaturan → Kunci API).
api_keystringwajibAPI key Anda dari halaman yang sama.
whatsapp_clientintegerwajibID nomor WhatsApp yang ingin diperiksa, dari WhatsApp settings (pengaturan WhatsApp), Daftar akun, atau
whatsapp_client_idyang dikembalikan oleh Hubungkan nomor.
Menggunakan klien resmi#
Klien Python memanggil endpoint ini untuk Anda.
from wbiztool_client import WbizToolClient
client = WbizToolClient(api_key="YOUR_API_KEY", client_id=12345)
result = client.get_whatsapp_client_status(678)
print(result)Klien Python memunculkan requests.exceptions.HTTPError ketika API mengembalikan HTTP 400 atau 403, jadi bungkus panggilan dengan try/except.
getWhatsAppClientStatus() di klien Node.js memanggil alamat yang tidak ada dan gagal dengan 404. Gunakan fetch seperti pada Contoh singkat.
Respons#
Jika kredensial Anda valid, request mengembalikan HTTP 200 dengan salah satu body berikut.
Nomor terhubung:
{ "message": "Connected", "status": 1 }
Nomor tidak terhubung:
{ "message": "Disconnected", "status": 0 }
| Field | Tipe | Deskripsi |
|---|---|---|
status | integer | 1 jika nomor terhubung. 0 jika nomor tidak terhubung atau request gagal. |
message | string | Connected, Disconnected, atau error. |
Nomor yang sudah Anda hapus dari WhatsApp settings juga mengembalikan Disconnected.
Error#
| Pesan | HTTP | Cara memperbaikinya |
|---|---|---|
Auth Error | 200 | Kirim client_id, api_key, dan whatsapp_client berupa angka di body POST, sebagai JSON atau field formulir yang valid. |
Invalid Client Id | 403 | Kirim client_id sebagai bilangan bulat, misalnya 12345. |
Auth Error: invalid api key | 400 | Pastikan key tersebut ada, belum dihapus, dan milik client_id ini. |
Auth Error 2 | 200 | ID whatsapp_client tersebut tidak ada di workspace API key ini. |
Demo Account can not access apis | 200 | Gunakan akun biasa. |
Tips#
- Sebelum mengirim: jika nomor pengirim terputus, pesannya menunggu di antrean sampai nomor tersebut terhubung kembali atau pesannya kedaluwarsa, jadi periksa status sebelum pengiriman besar. Pesan yang belum terkirim pada nomor yang terputus dihapus setelah 90 hari.
- Setelah menghubungkan nomor: lakukan polling ke endpoint ini setiap beberapa detik sampai mengembalikan
Connected. Webhookconnectedbisa tiba beberapa detik sebelum endpoint ini mengembalikanConnected, jadi lanjutkan polling hingga satu menit setelah event tersebut. Lihat Hubungkan nomor. - Semua nomor sekaligus: untuk mendapatkan status setiap nomor dalam satu panggilan, gunakan Daftar akun.
