REST API
#
SDK LibraryJika anda kesulitan menggunakan RAW REST API, anda bisa menggunakan Library yang kami telah sediakan pada di link dibawah ini:
#
Catatan Penting Sebelum Memulai- Di sini kami tidak memberikan full nama url API Endpoint / API URL, sebagai gantinya kami mengganti menjadi
example.com
- Ketika anda berlangganan produk Whatsapp Gateway kami, kami akan memberikan FULL URL Login Panel beserta URL API Endpointnya, ganti
example.com
sesuai alamat API Endpoint yang kami berikan - Pastikan untuk mengganti data sesuai data yang benar, seperti :
- YOUR-TOKEN-HERE
- YOUR-DEVICE-ID
- YOUR-WHATSAPP-NUMBER
- Jika anda tidak mengetahui TOKEN dan DEVICE-ID, silahkan cek email detail whatsapp kami pada bagian "[PENTING] Penggunaan Whatsapp Gateway dan REST API" atau jika anda sedang melakukan trial, TOKEN dan DEVICE-ID kami lampirkan langsung pada detail trial beserta URL API Endpoint.
#
Api End Point/api/v1
#
Send MessageKirim pesan ke nomor whatsapp.
POST /message/send
#
Request HeaderName | Value | Type |
---|---|---|
Accept | application/json | required |
Authentication | Bearer YOUR-TOKEN-HERE | required |
#
Request BodyName | Value | Type |
---|---|---|
deviceid | Your Device ID | required |
number | Whatsapp Number Destionation | required |
message | Your Message | required |
#
Responses{ "code": 200, "message": "success, message will be send in background."}
#
Example Send Message- Curl
curl -s \ -X POST \ -H "Accept: application/json" \ -H "Authorization: Bearer YOUR-TOKEN-HERE" \ -d "deviceid=YOUR-DEVICE-ID" \ -d "number=YOUR-WHATSAPP-NUMBER" \ -d "message=hai ini hanya test" \ https://example.com/api/v1/message/send
- PHP
<?php
$postData = array( 'deviceid' => 'YOUR-DEVICE-ID', 'number' => '08xxxxxxxxx', 'message' => 'hai ini hanya test',);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://example.com/api/v1/message/send');curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = array();$headers[] = 'Accept: application/json';$headers[] = 'Authorization: Bearer YOUR-TOKEN-HERE';curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);if (curl_errno($ch)) { echo 'Error:' . curl_error($ch);}curl_close($ch);
print_r($result);
#
Send Bulk MessageKirim pesan whatsapp ke banyak nomor.
POST /message/sendbulk
#
Request HeaderName | Value | Type |
---|---|---|
Accept | application/json | required |
Authentication | Bearer YOUR-TOKEN-HERE | required |
#
Request BodyName | Value | Type |
---|---|---|
deviceid | Your Device ID | string |
number | Multiple Whatsapp Number Destionation | array |
message | Your Message | string |
#
Responses{ "code": 200, "message": "success, all message in waiting list."}
#
Example Send Bulk Message- Curl
curl -s \ -X POST \ -H "Accept: application/json" \ -H "Authorization: Bearer YOUR-TOKEN-HERE" \ -d '{"deviceid": "YOUR-DEVICE-ID", "number": [ 08xxxxxxxxx1, 08xxxxxxxxx2 ], "message": "hai ini hanya test"}' \ https://example.com/api/v1/message/sendbulk
- PHP
<?php
$postData = array( 'deviceid' => 'YOUR-DEVICE-ID', 'number' => array( '08xxxxxxxxx1', '08xxxxxxxxx2', ), 'message' => 'hai ini hanya test',);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://example.com/api/v1/message/sendbulk');curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = array();$headers[] = 'Accept: application/json';$headers[] = 'Authorization: Bearer YOUR-TOKEN-HERE';curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);if (curl_errno($ch)) { echo 'Error:' . curl_error($ch);}curl_close($ch);
print_r($result);
#
Send Message to GroupKirim pesan whatsapp ke group.
POST /message/sendgroup/{groupID}
#
Request HeaderName | Value | Type |
---|---|---|
Accept | application/json | required |
Authentication | Bearer YOUR-TOKEN-HERE | required |
#
Request BodyName | Value | Type |
---|---|---|
deviceid | Your Device ID | string |
groupID | Contact Group ID. | string |
message | Your Message | string |
#
Responses{ "code": 200, "message": "success, all message in waiting list."}
#
Example Send Message to Group- Curl
curl -s \ -X POST \ -H "Accept: application/json" \ -H "Authorization: Bearer YOUR-TOKEN-HERE" \ -d '{"deviceid": "YOUR-DEVICE-ID", "message": "hai ini hanya test"}' \ https://example.com/api/v1/sendgroup/{groupID}
- PHP
<?php
$postData = array( 'deviceid' => 'YOUR-DEVICE-ID', 'message' => 'hai ini hanya test',);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://example.com/api/v1/message/sendgroup/{groupID}');curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = array();$headers[] = 'Accept: application/json';$headers[] = 'Authorization: Bearer YOUR-TOKEN-HERE';curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);if (curl_errno($ch)) { echo 'Error:' . curl_error($ch);}curl_close($ch);
print_r($result);