Introduction
The Whatsnesia API follows RESTful architecture standards, offering clear and consistent resource-based endpoints. All requests and responses are transmitted in JSON format, leveraging standard HTTP verbs, status codes, and authentication protocols to enable secure, efficient, and scalable integrations.
API Base URL
Please note that Whatsnesia does not provide a sandbox or test environment. All API requests are processed in the live environment, so ensure that all request data and parameters are accurate before making any calls.
https://whatsnesia.com/external-api
Authentication
All requests to the Whatsnesia API require authentication. Each API request must include a valid client-id and client-secret to the request header, which can be obtained from your Whatsnesia Dashboard under Developer Tools.
In addition to credentials, Whatsnesia enforces IP-based security. You must register and enable your server’s public IP address in the IP Whitelist section of the dashboard. Requests originating from non-whitelisted IP addresses will be automatically rejected.
Both valid API credentials and an approved IP address are mandatory. Without completing these two steps, authentication will fail and API access will not be granted.
Response Format
All responses from the Whatsnesia API are returned in JSON format. Each response follows a consistent structure and includes a status indicator, message, and relevant data payload when applicable. Standard HTTP status codes are used to represent the outcome of each request.
Contoh Respons Berhasil
{
"status": "success",
"remark": "contact_list",
"message":[
"Contact list fetched successfully"
],
"data": {
...you get all data here
}
}
Contoh Respons Error
{
"remark": "Unauthorized",
"status": "error",
"message": [
"The client secret is required"
]
}
{
"remark": "Unauthorized",
"status": "error",
"message": [
"Access to this API endpoint is restricted to IP addresses that have been explicitly whitelisted.",
"In order to access this API endpoint, please add your IP address (::1) to the white list from the user dashboard."
]
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/contact/list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Get Contact List
This endpoint allows you to retrieve a complete list of contacts associated with your Whatsnesia account.
Parameter Query
Parameter query yang memungkinkan Anda menyesuaikan respons API.
| Nama | Deskripsi | Wajib | Bawaan |
|---|---|---|---|
halaman |
Menentukan nomor halaman yang diambil. | Tidak | 1 |
paginasi |
Menentukan jumlah item yang dikembalikan per halaman. | Tidak | 20 |
pencarian |
Mencari kontak berdasarkan nama depan, nama belakang, atau nomor mobile. | Tidak | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/contact/store',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('firstname' => 'John','lastname' => 'Doe','mobile_code' => '880','mobile' => '01988'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Buat Kontak Baru
This endpoint allows you to add a new contact to your Whatsnesia account. Provide the necessary contact details, and upon successful request, the API returns the created contact’s information in JSON format for easy integration.
Field Wajib
Field berikut wajib diisi untuk membuat kontak baru di sistem.
| Nama | Wajib | Bawaan |
|---|---|---|
nama_depan |
Ya | - |
nama_belakang |
Ya | - |
kode_mobile |
Ya | - |
seluler |
Ya | - |
kota |
Tidak | - |
provinsi |
Tidak | - |
kode_pos |
Tidak | - |
alamat |
Tidak | - |
gambar_profil |
Tidak | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/contact/update/{contactId}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('firstname' => 'John','lastname' => 'Doe','mobile_code' => '880','mobile' => '01988'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Perbarui Kontak
Endpoint ini memungkinkan Anda memperbarui kontak yang sudah ada. Anda hanya perlu mengirim field yang ingin diubah. Field yang tidak disertakan dalam request akan tetap.
Field Wajib
Field berikut wajib diisi untuk membuat kontak baru di sistem.
| Nama | Wajib | Bawaan |
|---|---|---|
nama_depan |
Ya | - |
nama_belakang |
Ya | - |
kode_mobile |
Ya | - |
seluler |
Ya | - |
kota |
Tidak | - |
provinsi |
Tidak | - |
kode_pos |
Tidak | - |
alamat |
Tidak | - |
gambar_profil |
Tidak | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/contact/delete/{contactId}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_POSTFIELDS => array('firstname' => 'John','lastname' => 'Doe','mobile_code' => '880','mobile' => '01988'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Hapus Kontak
Endpoint ini memungkinkan Anda menghapus kontak berdasarkan ID uniknya. Penghapusan mungkin dibatasi jika kontak memiliki pesan terkait atau sedang diblokir.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/inbox/conversation-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Daftar Percakapan
Ambil daftar percakapan terpaginasinya untuk pengguna yang terautentikasi, termasuk info kontak dan status percakapan.
Parameter Query
| Nama | Deskripsi | Bawaan |
|---|---|---|
status |
Filter percakapan berdasarkan status. Gunakan nilai di bawah untuk memfilter percakapan via status. Done = 1; Pending = 2; Important = 3; Unread = 4; | Semua |
halaman |
Menentukan nomor halaman yang diambil. | 1 |
paginasi |
Menentukan jumlah item yang dikembalikan per halaman. | 20 |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/inbox/change-conversation-status/2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('status' => '1'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Ubah Status Percakapan
Perbarui status percakapan seperti pending, done, atau important. Di sini Done = 1, Pending = 2, Important = 3, UnRead = 4
Parameter URL
| Param | Tipe | Deskripsi |
|---|---|---|
conversation_id |
integer | ID unik percakapan |
Isi Permintaan
| Kolom | Tipe | Wajib |
|---|---|---|
status |
integer | YEs |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/inbox/conversation-details/2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array('status' => '1'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Detail Percakapan
Ambil detail lengkap percakapan termasuk informasi kontak, catatan, tag, dan asosiasi daftar.
Parameter URL
| Param | Tipe | Deskripsi |
|---|---|---|
conversation_id |
integer | ID unik percakapan |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/inbox/send-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('mobile_code' => '880','mobile' => xxxxxxxxx','message' => 'Hello world'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Kirim Pesan
Kirim pesan WhatsApp ke nomor mobile. Endpoint ini mendukung teks, media, lokasi, daftar interaktif, URL CTA, dan pesan e-commerce. Jika tidak ditemukan kontak atau percakapan untuk nomor telepon yang diberikan, kontak dan percakapan baru akan dibuat otomatis.
Isi Permintaan
| Kolom | Tipe | Wajib | Deskripsi |
|---|---|---|---|
mobile_code |
string | yes | Kode negara mobile. Harus berupa kode negara numerik yang valid tanpa tanda plus (+). |
mobile |
string | yes | Nomor ponsel valid yang terkait dengan kode negara yang diberikan. |
from_number |
string | conditional | Diperlukan nomor WhatsApp Business yang valid dan terdaftar pada akun Anda serta di dashboard Meta. Jika tidak ada ID yang diberikan, pesan akan dikirim menggunakan akun WhatsApp default yang terdaftar. |
message |
string | Conditional | Isi pesan teks. Wajib jika tidak ada media, lokasi, atau data interaktif yang diberikan |
image |
file | No | File gambar (jpg, jpeg, png - maks 5MB) |
document |
file | No | File dokumen (pdf, doc, docx - maks 100MB) |
video |
file | No | File video (mp4 - maks 16MB) |
audio |
file | No | File audio - maks 16MB |
latitude |
decimal | Conditional | Latitude untuk pesan lokasi |
longitude |
decimal | Conditional | Longitude untuk pesan lokasi |
cta_url_id |
integer | No | ID URL CTA untuk pesan tombol interaktif |
interactive_list_id |
integer | No | ID daftar interaktif |
Catatan
Setidaknya satu jenis pesan harus disediakan.
Pesan interaktif memerlukan paket aktif.
Kontak yang diblokir tidak dapat mengirim atau menerima pesan.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/inbox/send-template-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('mobile_code' => '880','mobile' => 'xxxxxx','testmplate_id' => 'your template id'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Kirim Pesan Template
Kirim pesan template WhatsApp yang sudah disetujui ke percakapan yang sudah ada. Pesan template umumnya digunakan untuk notifikasi, peringatan, dan komunikasi yang diprakarsai bisnis.
Isi Permintaan
| Kolom | Tipe | Wajib | Deskripsi |
|---|---|---|---|
mobile_code |
string | yes | Kode negara mobile. Harus berupa kode negara numerik yang valid tanpa tanda plus (+). |
mobile |
string | yes | Nomor ponsel valid yang terkait dengan kode negara yang diberikan. |
from_number |
string | conditional | Diperlukan nomor WhatsApp Business yang valid dan terdaftar pada akun Anda serta di dashboard Meta. Jika tidak ada ID yang diberikan, pesan akan dikirim menggunakan akun WhatsApp default yang terdaftar. |
template_id |
integer | Yes | ID template WhatsApp yang disetujui |
Catatan
Hanya template WhatsApp yang sudah disetujui yang dapat dikirim.
Pesan template biasanya digunakan untuk percakapan yang diprakarsai bisnis.
Kontak yang diblokir tidak dapat menerima pesan template.
Akun WhatsApp harus terhubung sebelum mengirim pesan.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://whatsnesia.com/extern-api/inbox/template-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Ambil Daftar Template
Endpoint ini memungkinkan Anda mengambil semua template WhatsApp yang terkait dengan akun Anda.