REST API Documentation
Integrate wasender into your applications with ease.
Documentation Menu
https://wasenderdha.my.id/send-message
Send Text Message
Kirim pesan teks WhatsApp secara otomatis melalui API. Pastikan perangkat Anda sudah terhubung (Scan QR) sebelum mengirim pesan.
Query Parameters & Body
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | REQUIRED | API Key unik Anda dari dashboard. |
sender |
string | REQUIRED | Nomor pengirim (nomor WA yang terhubung). Contoh: 62888xxxx |
number |
string | REQUIRED | Nomor tujuan (internasional format). Contoh: 62812345678 |
message |
string | REQUIRED | Isi pesan yang ingin dikirimkan. Dukung format WhatsApp (bold, italic). |
Code Implementation
$url = "https://wasenderdha.my.id/send-message";
$postData = [
'api_key' => 'YOUR_API_KEY',
'sender' => 'YOUR_SENDER_NUMBER',
'number' => '628123456789',
'message' => 'Hello from wasender API!'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
const axios = require('axios');
const data = {
api_key: 'YOUR_API_KEY',
sender: 'YOUR_SENDER_NUMBER',
number: '628123456789',
message: 'Hello from Node.js!'
};
axios.post('https://wasenderdha.my.id/send-message', data)
.then(res => console.log(res.data))
.catch(err => console.error(err));
import requests
url = "https://wasenderdha.my.id/send-message"
data = {
'api_key': 'YOUR_API_KEY',
'sender': 'YOUR_SENDER_NUMBER',
'number': '628123456789',
'message': 'Hello from Python!'
}
response = requests.post(url, data=data)
print(response.json())
https://wasenderdha.my.id/send-media
Send Media Message
Kirim file media seperti Gambar, Video, Audio, Dokumen, atau PDF. Pastikan URL file adalah link langsung (direct link).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | REQUIRED | API Key unik Anda. |
sender |
string | REQUIRED | Nomor pengirim (nomor WA yang terhubung). |
number |
string | REQUIRED | Nomor tujuan (format internasional). |
media_type |
enum | REQUIRED | image, video, audio, pdf, xls, xlsx, doc, docx, zip |
url |
string | REQUIRED | Direct link ke file media. |
caption |
string | OPTIONAL | Caption untuk image atau video. |
ppt |
boolean | OPTIONAL | Jika audio, set true untuk Voice Note. |
Code Implementation
$url = "https://wasenderdha.my.id/send-media";
$postData = [
'api_key' => 'YOUR_API_KEY',
'sender' => 'YOUR_SENDER_NUMBER',
'number' => '628123456789',
'media_type' => 'image',
'url' => 'https://example.com/image.jpg',
'caption' => 'Hello from API!'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
const axios = require('axios');
const data = {
api_key: 'YOUR_API_KEY',
sender: 'YOUR_SENDER_NUMBER',
number: '628123456789',
media_type: 'image',
url: 'https://example.com/image.jpg',
caption: 'Hello from Node.js!'
};
axios.post('https://wasenderdha.my.id/send-media', data)
.then(res => console.log(res.data))
.catch(err => console.error(err));
import requests
url = "https://wasenderdha.my.id/send-media"
data = {
'api_key': 'YOUR_API_KEY',
'sender': 'YOUR_SENDER_NUMBER',
'number': '628123456789',
'media_type': 'image',
'url': 'https://example.com/image.jpg',
'caption': 'Hello from Python!'
}
response = requests.post(url, data=data)
print(response.json())
https://wasenderdha.my.id/send-button
Send Button Message
Kirim pesan dengan tombol interaktif (Quick Reply). Anda dapat mengirim hingga 5 tombol sekaligus.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | REQUIRED | API Key unik Anda. |
sender |
string | REQUIRED | Nomor pengirim yang terhubung. |
number |
string | REQUIRED | Nomor tujuan (format internasional). |
message |
string | REQUIRED | Isi pesan utama. |
button |
array | REQUIRED | Daftar teks tombol. Contoh: ["Setuju", "Tolak"] |
footer |
string | OPTIONAL | Teks kecil di bagian bawah pesan. |
url |
string | OPTIONAL | Link gambar atau video header (jika ada). |
Code Implementation
$url = "https://wasenderdha.my.id/send-button";
$postData = [
'api_key' => 'YOUR_API_KEY',
'sender' => 'YOUR_SENDER_NUMBER',
'number' => '628123456789',
'message' => 'Silahkan pilih opsi:',
'button' => ['Pilihan 1', 'Pilihan 2'],
'footer' => 'Wasender Powered'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
const axios = require('axios');
const data = {
api_key: 'YOUR_API_KEY',
sender: 'YOUR_SENDER_NUMBER',
number: '628123456789',
message: 'Silahkan pilih opsi:',
button: ['Pilihan 1', 'Pilihan 2'],
footer: 'Wasender Powered'
};
axios.post('https://wasenderdha.my.id/send-button', data)
.then(res => console.log(res.data))
.catch(err => console.error(err));
import requests
url = "https://wasenderdha.my.id/send-button"
data = {
'api_key': 'YOUR_API_KEY',
'sender': 'YOUR_SENDER_NUMBER',
'number': '628123456789',
'message': 'Silahkan pilih opsi:',
'button': ['Pilihan 1', 'Pilihan 2'],
'footer': 'Wasender Powered'
}
response = requests.post(url, data=data)
print(response.json())
https://wasenderdha.my.id/send-template
Send Template Message
Kirim pesan dengan tombol template (Call & URL). Anda dapat mengirim hingga 3 tombol template.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | REQUIRED | API Key unik Anda. |
sender |
string | REQUIRED | Nomor pengirim yang terhubung. |
number |
string | REQUIRED | Nomor tujuan (format internasional). |
message |
string | REQUIRED | Isi pesan utama. |
template |
array | REQUIRED | Format: call|Label|Nomor atau url|Label|Link |
footer |
string | OPTIONAL | Teks footer pesan. |
url |
string | OPTIONAL | URL gambar header. |
Code Implementation
$url = "https://wasenderdha.my.id/send-template";
$postData = [
'api_key' => 'YOUR_API_KEY',
'sender' => 'YOUR_SENDER_NUMBER',
'number' => '628123456789',
'message' => 'Hubungi kami atau kunjungi situs:',
'template' => [
'call|Hubungi Kami|628123456789',
'url|Kunjungi Situs|google.com'
],
'footer' => 'Wasender Systems'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
const axios = require('axios');
const data = {
api_key: 'YOUR_API_KEY',
sender: 'YOUR_SENDER_NUMBER',
number: '628123456789',
message: 'Hubungi kami atau kunjungi situs:',
template: [
'call|Hubungi Kami|628123456789',
'url|Kunjungi Situs|google.com'
],
footer: 'Wasender Systems'
};
axios.post('https://wasenderdha.my.id/send-template', data)
.then(res => console.log(res.data))
.catch(err => console.error(err));
import requests
url = "https://wasenderdha.my.id/send-template"
data = {
'api_key': 'YOUR_API_KEY',
'sender': 'YOUR_SENDER_NUMBER',
'number': '628123456789',
'message': 'Hubungi kami atau kunjungi situs:',
'template': [
'call|Hubungi Kami|628123456789',
'url|Kunjungi Situs|google.com'
],
'footer': 'Wasender Systems'
}
response = requests.post(url, data=data)
print(response.json())
https://wasenderdha.my.id/send-list
Send List Message
Kirim pesan daftar (List Menu) yang memungkinkan pengguna memilih salah satu opsi dari menu yang muncul. Fitur ini sangat berguna untuk membuat bot navigasi yang rapi.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | REQUIRED | API Key unik Anda. |
sender |
string | REQUIRED | Nomor pengirim yang terhubung. |
number |
string | REQUIRED | Nomor tujuan (format internasional). |
title |
string | REQUIRED | Judul header pada menu list. |
name |
string | REQUIRED | Nama/Label list. |
message |
string | REQUIRED | Isi pesan utama di atas list. |
buttontext |
string | REQUIRED | Teks pada tombol untuk membuka list. |
list |
array | REQUIRED | Daftar opsi (array). Maksimal 10 opsi. |
footer |
string | OPTIONAL | Teks footer pesan. |
Code Implementation
$url = "https://wasenderdha.my.id/send-list";
$postData = [
'api_key' => 'YOUR_API_KEY',
'sender' => 'YOUR_SENDER_NUMBER',
'number' => '628123456789',
'title' => 'Menu Layanan',
'name' => 'Pilih Layanan',
'message' => 'Silahkan pilih menu di bawah ini:',
'buttontext' => 'Lihat Menu',
'list' => ['Layanan A', 'Layanan B', 'Layanan C'],
'footer' => 'Wasender Powered'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
const axios = require('axios');
const data = {
api_key: 'YOUR_API_KEY',
sender: 'YOUR_SENDER_NUMBER',
number: '628123456789',
title: 'Menu Layanan',
name: 'Pilih Layanan',
message: 'Silahkan pilih menu di bawah ini:',
buttontext: 'Lihat Menu',
list: ['Layanan A', 'Layanan B', 'Layanan C'],
footer: 'Wasender Powered'
};
axios.post('https://wasenderdha.my.id/send-list', data)
.then(res => console.log(res.data))
.catch(err => console.error(err));
import requests
url = "https://wasenderdha.my.id/send-list"
data = {
'api_key': 'YOUR_API_KEY',
'sender': 'YOUR_SENDER_NUMBER',
'number': '628123456789',
'title': 'Menu Layanan',
'name': 'Pilih Layanan',
'message': 'Silahkan pilih menu di bawah ini:',
'buttontext': 'Lihat Menu',
'list': ['Layanan A', 'Layanan B', 'Layanan C'],
'footer': 'Wasender Powered'
}
response = requests.post(url, data=data)
print(response.json())
API Responses
Setiap permintaan API akan mengembalikan data dalam format JSON. Berikut adalah contoh respon yang mungkin Anda terima.
SUCCESS Success Response
{
"status": true,
"msg": "Message sent successfully!"
}
FAILED Failed Response
{
"status": false,
"msg": "Message failed to send!"
}
INVALID Validation Error
{
"status": false,
"msg": "Invalid data!",
"errors": {
"number": ["The number field is required."]
}
}
SERVER Connection Error
{
"status": false,
"msg": "Failed to send message!",
"errors": "Failed to access whatsapp server"
}
https://wasenderdha.my.id/generate-qr
Generate QR Code
Gunakan endpoint ini untuk mendapatkan QR Code autentikasi WhatsApp secara programatik.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | REQUIRED | API Key unik Anda. |
device |
string | REQUIRED | Nomor device yang ingin dihubungkan. |
API Responses
PROCESSING Processing Response
{
"status": "processing",
"message": "Processing"
}
Jika menerima respon ini, silahkan hit kembali endpoint setelah 2-3 detik untuk mendapatkan QR code.
QR READY QR Code Response
{
"status": true,
"qrcode": "data:image/png;base64,iVBORw0...",
"message": "Please scan qrcode"
}
qrcode berisi string Base64 yang dapat langsung ditampilkan sebagai gambar.
Code Implementation
$url = "https://wasenderdha.my.id/generate-qr";
$postData = [
'api_key' => 'YOUR_API_KEY',
'device' => 'YOUR_DEVICE_NUMBER'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if(isset($result['qrcode'])) {
echo '<img src="'.$result['qrcode'].'" />';
} else {
echo $result['message'];
}
const axios = require('axios');
const data = {
api_key: 'YOUR_API_KEY',
device: 'YOUR_DEVICE_NUMBER'
};
axios.post('https://wasenderdha.my.id/generate-qr', data)
.then(res => {
if(res.data.status === true) {
console.log('QR Code Base64:', res.data.qrcode);
} else {
console.log('Status:', res.data.message);
}
})
.catch(err => console.error(err));
Webhook Integration
Webhook memungkinkan server Anda menerima notifikasi secara real-time saat ada pesan masuk atau perubahan status. Server kami akan mengirimkan POST request dengan format JSON ke URL yang Anda tentukan.
Callback Payload (JSON)
{
"message": "Halo, apa kabar?",
"from": "628123456789",
"bufferImage": null,
"participant": "6289876543210"
}
Example Webhook Processor (PHP)
Berikut adalah contoh sederhana bagaimana menangani data yang dikirimkan oleh webhook kami di server Anda.
<?php
// Ambil data JSON dari request body
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if ($data) {
$from = $data['from'];
$message = $data['message'];
// Logika chatbot sederhana
if (strtolower($message) == 'halo') {
// Balas pesan via API Send Message
// ... kode kirim pesan Anda di sini ...
}
// Selalu balas dengan HTTP 200
http_response_code(200);
}
?>
Tips Keamanan
Pastikan URL Webhook Anda menggunakan HTTPS untuk menjaga keamanan data yang dikirimkan.