Panduan lengkap untuk mengintegrasikan WhatsApp ke aplikasi Anda
WACloud menyediakan RESTful API yang powerful untuk mengintegrasikan WhatsApp ke dalam aplikasi Anda. API ini dirancang khusus untuk developer dengan dokumentasi lengkap dan contoh kode yang mudah dipahami.
https://app.wacloud.id/api/v1
Semua request ke API memerlukan API Key yang dapat Anda buat di dashboard setelah mendaftar.
Kirim API Key di header HTTP dengan format berikut:
X-Api-Key: waha_your_api_key_here
Berikut adalah daftar endpoint utama yang tersedia:
Mendapatkan daftar semua device WhatsApp yang terhubung.
Mengirim pesan WhatsApp. Mendukung berbagai jenis pesan.
Mendapatkan daftar pesan yang telah dikirim atau diterima.
Sinkronisasi pesan masuk dari WAHA ke database.
Mendapatkan detail device WhatsApp berdasarkan ID.
Mendapatkan QR code untuk pairing device WhatsApp.
Mendapatkan daftar semua template pesan.
Mendapatkan informasi akun dan quota.
Mengirim kode OTP ke nomor tujuan.
Mendapatkan daftar kontak untuk device tertentu.
Mendapatkan informasi kontak tertentu.
Memperbarui informasi kontak.
Memeriksa apakah nomor telepon terdaftar di WhatsApp.
Untuk mengirim pesan, gunakan endpoint POST /api/v1/messages dengan format berikut:
{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "text",
"text": "Halo, ini pesan dari API!"
}
{
"success": true,
"data": {
"message_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"whatsapp_message_id": "3EB0...",
"status": "sent",
"ack": 1,
"to": "6281234567890"
}
}
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "text",
"text": "Halo, ini pesan dari API!"
}'
// Kirim pesan text
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'text',
'text' => 'Halo, ini pesan dari API!'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Message ID: " . $result['data']['message_id'];
}
import requests
api_key = 'YOUR_API_KEY'
url = 'https://app.wacloud.id/api/v1/messages'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'text',
'text': 'Halo, ini pesan dari API!'
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
print(f("Message ID: {result['data']['message_id']}"))
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'text',
text: 'Halo, ini pesan dari API!'
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
})
.then(response => {
if (response.data.success) {
console.log(`Message ID: ${response.data.data.message_id}`);
}
})
.catch(error => {
console.error('Error:', error.response?.data || error.message);
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'text',
text: 'Halo, ini pesan dari API!'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
console.log(`Message ID: ${result.data.message_id}`);
}
})
.catch(error => {
console.error('Error:', error);
});
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
type SendMessageRequest struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
Text string `json:"text"`
}
func main() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := SendMessageRequest{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "text",
Text: "Halo, ini pesan dari API!",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
WACloud mendukung berbagai jenis pesan WhatsApp:
Pesan teks biasa.
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "text",
"text": "Pesan teks"
}'
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'text',
'text' => 'Pesan teks'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
response = requests.post(
'https://app.wacloud.id/api/v1/messages',
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'text',
'text': 'Pesan teks'
}
)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'text',
text: 'Pesan teks'
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'text',
text: 'Pesan teks'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type TextMessage struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
Text string `json:"text"`
}
func sendTextMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := TextMessage{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "text",
Text: "Pesan teks",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}
Mengirim gambar dengan URL. URL harus dapat diakses secara publik.
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "image",
"image_url": "https://example.com/image.jpg",
"caption": "Caption gambar"
}'
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'image',
'image_url' => 'https://example.com/image.jpg',
'caption' => 'Caption gambar'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
response = requests.post(
'https://app.wacloud.id/api/v1/messages',
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'image',
'image_url': 'https://example.com/image.jpg',
'caption': 'Caption gambar'
}
)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'image',
image_url: 'https://example.com/image.jpg',
caption: 'Caption gambar'
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'image',
image_url: 'https://example.com/image.jpg',
caption: 'Caption gambar'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type ImageMessage struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
ImageURL string `json:"image_url"`
Caption string `json:"caption"`
}
func sendImageMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := ImageMessage{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "image",
ImageURL: "https://example.com/image.jpg",
Caption: "Caption gambar",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}
Mengirim video dengan URL. URL harus dapat diakses secara publik.
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "video",
"video_url": "https://example.com/video.mp4",
"caption": "Caption video",
"as_note": false,
"convert": false
}'
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'video',
'video_url' => 'https://example.com/video.mp4',
'caption' => 'Caption video',
'as_note' => false,
'convert' => false
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
response = requests.post(
'https://app.wacloud.id/api/v1/messages',
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'video',
'video_url': 'https://example.com/video.mp4',
'caption': 'Caption video',
'as_note': False,
'convert': False
}
)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'video',
video_url: 'https://example.com/video.mp4',
caption: 'Caption video',
as_note: false,
convert: false
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'video',
video_url: 'https://example.com/video.mp4',
caption: 'Caption video',
as_note: false,
convert: false
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type VideoMessage struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
VideoURL string `json:"video_url"`
Caption string `json:"caption"`
AsNote bool `json:"as_note"`
Convert bool `json:"convert"`
}
func sendVideoMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := VideoMessage{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "video",
VideoURL: "https://example.com/video.mp4",
Caption: "Caption video",
AsNote: false,
Convert: false,
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}
Mengirim dokumen (PDF, DOC, dll) dengan URL. URL harus dapat diakses secara publik.
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "document",
"document_url": "https://example.com/file.pdf",
"filename": "document.pdf",
"caption": "Caption dokumen"
}'
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'document',
'document_url' => 'https://example.com/file.pdf',
'filename' => 'document.pdf',
'caption' => 'Caption dokumen'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
response = requests.post(
'https://app.wacloud.id/api/v1/messages',
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'document',
'document_url': 'https://example.com/file.pdf',
'filename': 'document.pdf',
'caption': 'Caption dokumen'
}
)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'document',
document_url: 'https://example.com/file.pdf',
filename: 'document.pdf',
caption: 'Caption dokumen'
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'document',
document_url: 'https://example.com/file.pdf',
filename: 'document.pdf',
caption: 'Caption dokumen'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type DocumentMessage struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
DocumentURL string `json:"document_url"`
Filename string `json:"filename"`
Caption string `json:"caption"`
}
func sendDocumentMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := DocumentMessage{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "document",
DocumentURL: "https://example.com/file.pdf",
Filename: "document.pdf",
Caption: "Caption dokumen",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}
Mengirim polling interaktif.
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "poll",
"poll_name": "Pertanyaan?",
"poll_options": ["Opsi 1", "Opsi 2"]
}'
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'poll',
'poll_name' => 'Pertanyaan?',
'poll_options' => ['Opsi 1', 'Opsi 2']
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
response = requests.post(
'https://app.wacloud.id/api/v1/messages',
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'poll',
'poll_name': 'Pertanyaan?',
'poll_options': ['Opsi 1', 'Opsi 2']
}
)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'poll',
poll_name: 'Pertanyaan?',
poll_options: ['Opsi 1', 'Opsi 2']
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'poll',
poll_name: 'Pertanyaan?',
poll_options: ['Opsi 1', 'Opsi 2']
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type PollMessage struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
PollName string `json:"poll_name"`
PollOptions []string `json:"poll_options"`
}
func sendPollMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := PollMessage{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "poll",
PollName: "Pertanyaan?",
PollOptions: []string{"Opsi 1", "Opsi 2"},
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}
Mengirim pesan dengan format list interaktif.
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "list",
"message": {
"title": "Judul",
"description": "Deskripsi",
"button": "Pilih",
"sections": []
}
}'
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'list',
'message' => [
'title' => 'Judul',
'description' => 'Deskripsi',
'button' => 'Pilih',
'sections' => []
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
response = requests.post(
'https://app.wacloud.id/api/v1/messages',
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'list',
'message': {
'title': 'Judul',
'description': 'Deskripsi',
'button': 'Pilih',
'sections': []
}
}
)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'list',
message: {
title: 'Judul',
description: 'Deskripsi',
button: 'Pilih',
sections: []
}
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'list',
message: {
title: 'Judul',
description: 'Deskripsi',
button: 'Pilih',
sections: []
}
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type ListMessage struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
Message map[string]interface{} `json:"message"`
}
func sendListMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := ListMessage{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "list",
Message: map[string]interface{}{
"title": "Judul",
"description": "Deskripsi",
"button": "Pilih",
"sections": []interface{}{},
},
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}
Berikut adalah contoh implementasi mengirim pesan menggunakan berbagai bahasa pemrograman:
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"message_type": "text",
"text": "Halo dari API!"
}'
// Kirim pesan text
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'message_type' => 'text',
'text' => 'Halo dari API!'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Message ID: " . $result['data']['message_id'];
}
import requests
# Kirim pesan text
api_key = 'YOUR_API_KEY'
url = 'https://app.wacloud.id/api/v1/messages'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'message_type': 'text',
'text': 'Halo dari API!'
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
print(f"Message ID: {result['data']['message_id']}")
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'text',
text: 'Halo dari API!'
};
axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
})
.then(response => {
if (response.data.success) {
console.log(`Message ID: ${response.data.data.message_id}`);
}
})
.catch(error => {
console.error('Error:', error.response?.data || error.message);
});
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
message_type: 'text',
text: 'Halo dari API!'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
console.log(`Message ID: ${result.data.message_id}`);
}
})
.catch(error => {
console.error('Error:', error);
});
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
type SendMessageRequest struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
MessageType string `json:"message_type"`
Text string `json:"text"`
}
func main() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := SendMessageRequest{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
MessageType: "text",
Text: "Halo dari API!",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Webhook memungkinkan Anda menerima notifikasi real-time ketika ada pesan masuk ke session WhatsApp Anda. Ini sangat berguna untuk membangun aplikasi yang reaktif dan responsif.
Untuk mengatur webhook, gunakan endpoint berikut:
Membuat webhook baru untuk menerima notifikasi pesan masuk.
{
"url": "https://your-domain.com/webhook",
"events": ["message", "status"],
"device_id": "550e8400-e29b-41d4-a716-446655440000"
}
# Membuat webhook
curl -X POST "https://app.wacloud.id/api/v1/webhooks" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-domain.com/webhook",
"events": ["message", "status"],
"device_id": "550e8400-e29b-41d4-a716-446655440000"
}'
import requests
api_key = 'YOUR_API_KEY'
url = 'https://app.wacloud.id/api/v1/webhooks'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'url': 'https://your-domain.com/webhook',
'events': ['message', 'status'],
'device_id': '550e8400-e29b-41d4-a716-446655440000'
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
print(f("Webhook created: {result['data']['id']}"))
// Membuat webhook
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/webhooks';
$data = [
'url' => 'https://your-domain.com/webhook',
'events' => ['message', 'status'],
'device_id' => '550e8400-e29b-41d4-a716-446655440000'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
// Menerima webhook di endpoint Anda
$payload = json_decode(file_get_contents('php://input'), true);
if ($payload['event'] === 'message') {
$from = $payload['data']['from'];
$body = $payload['data']['body'];
// Proses pesan masuk
echo "Pesan dari {$from}: {$body}";
}
const axios = require('axios');
const express = require('express');
const app = express();
// Membuat webhook
const createWebhook = async () => {
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/webhooks';
const data = {
url: 'https://your-domain.com/webhook',
events: ['message', 'status'],
device_id: '550e8400-e29b-41d4-a716-446655440000'
};
try {
const response = await axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
console.log('Webhook created:', response.data);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
// Menerima webhook
app.use(express.json());
app.post('/webhook', (req, res) => {
const { event, data } = req.body;
if (event === 'message') {
console.log(`Pesan dari ${data.from}: ${data.body}`);
// Proses pesan masuk
}
res.status(200).send('OK');
});
app.listen(3000, () => {
console.log('Webhook server running on port 3000');
});
// Membuat webhook
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/webhooks';
const data = {
url: 'https://your-domain.com/webhook',
events: ['message', 'status'],
device_id: '550e8400-e29b-41d4-a716-446655440000'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
console.log('Webhook created:', result.data);
}
})
.catch(error => {
console.error('Error:', error);
});
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
type WebhookRequest struct {
URL string `json:"url"`
Events []string `json:"events"`
DeviceID string `json:"device_id"`
}
func createWebhook() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/webhooks"
data := WebhookRequest{
URL: "https://your-domain.com/webhook",
Events: []string{"message", "status"},
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Menerima webhook
func webhookHandler(w http.ResponseWriter, r *http.Request) {
var payload map[string]interface{}
json.NewDecoder(r.Body).Decode(&payload)
if payload["event"] == "message" {
data := payload["data"].(map[string]interface{})
fmt.Printf("Pesan dari %v: %v\n", data["from"], data["body"])
}
w.WriteHeader(http.StatusOK)
}
func main() {
http.HandleFunc("/webhook", webhookHandler)
http.ListenAndServe(":3000", nil)
}
Ketika pesan masuk, webhook akan mengirim POST request ke URL yang Anda tentukan dengan payload berikut:
{
"event": "message",
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"data": {
"from": "6281234567890@c.us",
"to": "6289876543210@c.us",
"body": "Pesan masuk",
"message_type": "text",
"timestamp": 1234567890
}
}
Mendapatkan daftar semua webhook yang telah dibuat.
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/webhooks" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
response = requests.get(
'https://app.wacloud.id/api/v1/webhooks',
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
Menghapus webhook tertentu.
Contoh cURL:
curl -X DELETE "https://app.wacloud.id/api/v1/webhooks/webhook-id-here" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
webhook_id = 'webhook-id-here'
response = requests.delete(
f('https://app.wacloud.id/api/v1/webhooks/{webhook_id}'),
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
Template memungkinkan Anda membuat pesan dengan variabel dinamis yang dapat digunakan berulang kali. Sangat berguna untuk pesan otomatis, notifikasi, dan kampanye marketing.
Untuk membuat template baru, gunakan endpoint berikut:
Membuat template baru dengan variabel yang dapat diganti.
{
"name": "Order Confirmation",
"content": "Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}",
"message_type": "text",
"variables": ["name", "order_id", "amount"],
"description": "Template untuk konfirmasi pesanan"
}
curl -X POST "https://app.wacloud.id/api/v1/templates" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Order Confirmation",
"content": "Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}",
"message_type": "text",
"description": "Template untuk konfirmasi pesanan"
}'
import requests
api_key = 'YOUR_API_KEY'
url = 'https://app.wacloud.id/api/v1/templates'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'name': 'Order Confirmation',
'content': 'Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}',
'message_type': 'text',
'description': 'Template untuk konfirmasi pesanan'
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
print(f("Template ID: {result['data']['id']}"))
// Membuat template
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/templates';
$data = [
'name' => 'Order Confirmation',
'content' => 'Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}',
'message_type' => 'text',
'description' => 'Template untuk konfirmasi pesanan'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Template ID: " . $result['data']['id'];
}
const axios = require('axios');
const createTemplate = async () => {
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/templates';
const data = {
name: 'Order Confirmation',
content: 'Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}',
message_type: 'text',
description: 'Template untuk konfirmasi pesanan'
};
try {
const response = await axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
console.log('Template ID:', response.data.data.id);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
createTemplate();
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/templates';
const data = {
name: 'Order Confirmation',
content: 'Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}',
message_type: 'text',
description: 'Template untuk konfirmasi pesanan'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
console.log(`Template ID: ${result.data.id}`);
}
})
.catch(error => {
console.error('Error:', error);
});
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
type CreateTemplateRequest struct {
Name string `json:"name"`
Content string `json:"content"`
MessageType string `json:"message_type"`
Description string `json:"description"`
}
func createTemplate() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/templates"
data := CreateTemplateRequest{
Name: "Order Confirmation",
Content: "Halo @{{name}}, pesanan Anda #@{{order_id}} telah dikonfirmasi. Total: Rp @{{amount}}",
MessageType: "text",
Description: "Template untuk konfirmasi pesanan",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Untuk mengirim pesan menggunakan template, gunakan template_id dan variables dalam request:
{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"template_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"variables": {
"name": "John Doe",
"order_id": "ORD-12345",
"amount": "150.000"
}
}
curl -X POST "https://app.wacloud.id/api/v1/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "6281234567890",
"template_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"variables": {
"name": "John Doe",
"order_id": "ORD-12345",
"amount": "150.000"
}
}'
import requests
api_key = 'YOUR_API_KEY'
url = 'https://app.wacloud.id/api/v1/messages'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '6281234567890',
'template_id': 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'variables': {
'name': 'John Doe',
'order_id': 'ORD-12345',
'amount': '150.000'
}
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
print(f("Message sent: {result['data']['message_id']}"))
// Mengirim pesan menggunakan template
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '6281234567890',
'template_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'variables' => [
'name' => 'John Doe',
'order_id' => 'ORD-12345',
'amount' => '150.000'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Message sent: " . $result['data']['message_id'];
}
const axios = require('axios');
const sendTemplateMessage = async () => {
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
template_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
variables: {
name: 'John Doe',
order_id: 'ORD-12345',
amount: '150.000'
}
};
try {
const response = await axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
console.log('Message sent:', response.data.data.message_id);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
sendTemplateMessage();
const apiKey = 'YOUR_API_KEY';
const url = 'https://app.wacloud.id/api/v1/messages';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '6281234567890',
template_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
variables: {
name: 'John Doe',
order_id: 'ORD-12345',
amount: '150.000'
}
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
console.log(`Message sent: ${result.data.message_id}`);
}
})
.catch(error => {
console.error('Error:', error);
});
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
type SendTemplateMessageRequest struct {
DeviceID string `json:"device_id"`
To string `json:"to"`
TemplateID string `json:"template_id"`
Variables map[string]string `json:"variables"`
}
func sendTemplateMessage() {
apiKey := "YOUR_API_KEY"
url := "https://app.wacloud.id/api/v1/messages"
data := SendTemplateMessageRequest{
DeviceID: "550e8400-e29b-41d4-a716-446655440000",
To: "6281234567890",
TemplateID: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
Variables: map[string]string{
"name": "John Doe",
"order_id": "ORD-12345",
"amount": "150.000",
},
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Mendapatkan daftar semua template yang telah dibuat.
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/templates" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
response = requests.get(
'https://app.wacloud.id/api/v1/templates',
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
Mendapatkan detail template tertentu.
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/templates/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
template_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.get(
f('https://app.wacloud.id/api/v1/templates/{template_id}'),
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
Memperbarui template yang sudah ada.
Contoh cURL:
curl -X PUT "https://app.wacloud.id/api/v1/templates/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Template",
"content": "Updated content",
"message_type": "text"
}'
Contoh Python:
import requests
template_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.put(
f('https://app.wacloud.id/api/v1/templates/{template_id}'),
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'name': 'Updated Template',
'content': 'Updated content',
'message_type': 'text'
}
)
Menghapus template tertentu.
Contoh cURL:
curl -X DELETE "https://app.wacloud.id/api/v1/templates/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
template_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.delete(
f('https://app.wacloud.id/api/v1/templates/{template_id}'),
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
Preview template dengan variabel yang sudah diisi.
Contoh cURL:
curl -X POST "https://app.wacloud.id/api/v1/templates/a1b2c3d4-e5f6-7890-abcd-ef1234567890/preview" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"variables": {
"name": "John Doe",
"order_id": "ORD-12345",
"amount": "150.000"
}
}'
Contoh Python:
import requests
template_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.post(
f('https://app.wacloud.id/api/v1/templates/{template_id}/preview'),
headers={'X-Api-Key': 'YOUR_API_KEY'},
json={
'variables': {
'name': 'John Doe',
'order_id': 'ORD-12345',
'amount': '150.000'
}
}
)
Variabel dalam template menggunakan format @{{variable_name}}. Contoh:
"Halo @{{name}}, terima kasih telah memesan. Total pembayaran: Rp @{{total}}"
Device (atau Session) adalah koneksi WhatsApp yang terhubung ke akun Anda. Setiap device memerlukan proses pairing dengan QR code sebelum dapat digunakan untuk mengirim pesan.
Untuk membuat device baru, gunakan endpoint berikut:
Membuat device baru. Device akan dalam status "pairing" dan memerlukan QR code untuk terhubung.
{
"name": "Device Utama",
"phone_number": "81234567890"
}
{
"success": true,
"message": "Device created successfully. Use the pair endpoint to get QR code.",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Device Utama",
"status": "pairing",
"created_at": "2025-11-30T10:00:00Z"
}
}
Mendapatkan daftar semua device yang terhubung (status: connected).
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/devices" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
response = requests.get(
'https://app.wacloud.id/api/v1/devices',
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
Mendapatkan detail lengkap device berdasarkan ID.
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/devices/550e8400-e29b-41d4-a716-446655440000" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
device_id = '550e8400-e29b-41d4-a716-446655440000'
response = requests.get(
f('https://app.wacloud.id/api/v1/devices/{device_id}'),
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
Mendapatkan status device (connected, pairing, disconnected).
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/devices/550e8400-e29b-41d4-a716-446655440000/status" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
device_id = '550e8400-e29b-41d4-a716-446655440000'
response = requests.get(
f('https://app.wacloud.id/api/v1/devices/{device_id}/status'),
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
Setelah membuat device, Anda perlu mendapatkan QR code untuk menghubungkan WhatsApp ke device tersebut.
Mendapatkan QR code untuk pairing device dengan WhatsApp. QR code berlaku selama 2 menit.
{
"success": true,
"data": {
"qr_code": "data:image/png;base64,iVBORw0KGgoAAAANS...",
"expires_at": "2025-11-30T10:02:00Z",
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pairing"
}
}
# Membuat device baru
curl -X POST "https://app.wacloud.id/api/v1/devices" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Device Utama",
"phone_number": "81234567890"
}'
# Mendapatkan QR code (ganti {device_id} dengan ID dari response di atas)
curl -X GET "https://app.wacloud.id/api/v1/devices/{device_id}/pair" \
-H "X-Api-Key: YOUR_API_KEY"
import requests
api_key = 'YOUR_API_KEY'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
# Membuat device baru
url = 'https://app.wacloud.id/api/v1/devices'
data = {
'name': 'Device Utama',
'phone_number': '81234567890'
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
device_id = result['data']['id']
# Mendapatkan QR code
qr_url = f('https://app.wacloud.id/api/v1/devices/{device_id}/pair')
qr_response = requests.get(qr_url, headers={'X-Api-Key': api_key})
if qr_response.status_code == 200:
qr_result = qr_response.json()
if qr_result['success']:
print(f("QR Code: {qr_result['data']['qr_code']}"))
// Membuat device baru
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/devices';
$data = [
'name' => 'Device Utama',
'phone_number' => '81234567890'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
$deviceId = $result['data']['id'];
// Mendapatkan QR code
$qrUrl = "https://app.wacloud.id/api/v1/devices/{$deviceId}/pair";
$ch = curl_init($qrUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey
]);
$qrResponse = curl_exec($ch);
curl_close($ch);
$qrResult = json_decode($qrResponse, true);
if ($qrResult['success']) {
// QR code dalam format base64, bisa langsung digunakan di tag img
$qrCode = $qrResult['data']['qr_code'];
echo "<img src='{$qrCode}' alt='QR Code' />";
}
}
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
// Membuat device baru
const createDevice = async () => {
const url = 'https://app.wacloud.id/api/v1/devices';
const data = {
name: 'Device Utama',
phone_number: '81234567890'
};
try {
const response = await axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
if (response.data.success) {
const deviceId = response.data.data.id;
// Mendapatkan QR code
const qrResponse = await axios.get(
`https://app.wacloud.id/api/v1/devices/${deviceId}/pair`,
{
headers: {
'X-Api-Key': apiKey
}
}
);
if (qrResponse.data.success) {
const qrCode = qrResponse.data.data.qr_code;
console.log('QR Code:', qrCode);
}
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
createDevice();
import requests
api_key = 'YOUR_API_KEY'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
# Membuat device baru
url = 'https://app.wacloud.id/api/v1/devices'
data = {
'name': 'Device Utama',
'phone_number': '81234567890'
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
if result['success']:
device_id = result['data']['id']
# Mendapatkan QR code
qr_url = f('https://app.wacloud.id/api/v1/devices/{device_id}/pair')
qr_response = requests.get(qr_url, headers={'X-Api-Key': api_key})
if qr_response.status_code == 200:
qr_result = qr_response.json()
if qr_result['success']:
print(f("QR Code: {qr_result['data']['qr_code']}"))
const apiKey = 'YOUR_API_KEY';
// Membuat device baru
const url = 'https://app.wacloud.id/api/v1/devices';
const data = {
name: 'Device Utama',
phone_number: '81234567890'
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
const deviceId = result.data.id;
// Mendapatkan QR code
return fetch(
`https://app.wacloud.id/api/v1/devices/${deviceId}/pair`,
{
headers: {
'X-Api-Key': apiKey
}
}
);
}
})
.then(response => response.json())
.then(qrResult => {
if (qrResult.success) {
console.log('QR Code:', qrResult.data.qr_code);
}
})
.catch(error => {
console.error('Error:', error);
});
Device dapat memiliki status berikut:
Fitur OTP memungkinkan Anda mengirim kode verifikasi satu kali ke nomor WhatsApp. Sangat berguna untuk verifikasi akun, reset password, atau autentikasi dua faktor.
Untuk mengirim kode OTP, gunakan endpoint berikut:
Mengirim kode OTP 6 digit ke nomor tujuan. OTP akan expire dalam waktu yang ditentukan (default: 10 menit).
{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "81234567890",
"template_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"expiry_minutes": 10
}
{
"success": true,
"data": {
"otp_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"expires_at": "2025-11-30T12:10:00Z",
"expires_in_minutes": 10
}
}
Setelah mengirim OTP, verifikasi kode yang dimasukkan user:
Memverifikasi kode OTP yang telah dikirim.
{
"phone_number": "81234567890",
"code": "123456"
}
{
"success": true,
"message": "OTP verified successfully"
}
Mendapatkan status OTP berdasarkan ID (pending, verified, expired).
Contoh cURL:
curl -X GET "https://app.wacloud.id/api/v1/messages/otp/f47ac10b-58cc-4372-a567-0e02b2c3d479/status" \
-H "X-Api-Key: YOUR_API_KEY"
Contoh Python:
import requests
otp_id = 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
response = requests.get(
f('https://app.wacloud.id/api/v1/messages/otp/{otp_id}/status'),
headers={'X-Api-Key': 'YOUR_API_KEY'}
)
result = response.json()
# Mengirim OTP
curl -X POST "https://app.wacloud.id/api/v1/messages/otp" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "81234567890",
"expiry_minutes": 10
}'
# Verifikasi OTP
curl -X POST "https://app.wacloud.id/api/v1/messages/verify-otp" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "81234567890",
"code": "123456"
}'
// Mengirim OTP
$apiKey = 'YOUR_API_KEY';
$url = 'https://app.wacloud.id/api/v1/messages/otp';
$data = [
'device_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => '81234567890',
'expiry_minutes' => 10
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
$otpId = $result['data']['otp_id'];
echo "OTP sent! ID: {$otpId}\n";
// Verifikasi OTP (contoh: user memasukkan kode 123456)
$verifyUrl = 'https://app.wacloud.id/api/v1/messages/verify-otp';
$verifyData = [
'phone_number' => '81234567890',
'code' => '123456'
];
$ch = curl_init($verifyUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($verifyData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$verifyResponse = curl_exec($ch);
curl_close($ch);
$verifyResult = json_decode($verifyResponse, true);
if ($verifyResult['success']) {
echo "OTP verified successfully!\n";
} else {
echo "Error: " . $verifyResult['error'] . "\n";
}
}
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
// Mengirim OTP
const sendOTP = async () => {
const url = 'https://app.wacloud.id/api/v1/messages/otp';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '81234567890',
expiry_minutes: 10
};
try {
const response = await axios.post(url, data, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
});
if (response.data.success) {
console.log(`OTP sent! ID: ${response.data.data.otp_id}`);
// Verifikasi OTP (contoh: user memasukkan kode 123456)
const verifyResponse = await axios.post(
'https://app.wacloud.id/api/v1/messages/verify-otp',
{
phone_number: '81234567890',
code: '123456'
},
{
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
}
);
if (verifyResponse.data.success) {
console.log('OTP verified successfully!');
} else {
console.error('Error:', verifyResponse.data.error);
}
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
sendOTP();
import requests
api_key = 'YOUR_API_KEY'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
# Mengirim OTP
url = 'https://app.wacloud.id/api/v1/messages/otp'
data = {
'device_id': '550e8400-e29b-41d4-a716-446655440000',
'to': '81234567890',
'expiry_minutes': 10
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
result = response.json()
if result['success']:
print(f("OTP sent! ID: {result['data']['otp_id']}"))
# Verifikasi OTP (contoh: user memasukkan kode 123456)
verify_url = 'https://app.wacloud.id/api/v1/messages/verify-otp'
verify_data = {
'phone_number': '81234567890',
'code': '123456'
}
verify_response = requests.post(verify_url, headers=headers, json=verify_data)
if verify_response.status_code == 200:
verify_result = verify_response.json()
if verify_result['success']:
print("OTP verified successfully!")
else:
print(f("Error: {verify_result['error']}"))
const apiKey = 'YOUR_API_KEY';
// Mengirim OTP
const url = 'https://app.wacloud.id/api/v1/messages/otp';
const data = {
device_id: '550e8400-e29b-41d4-a716-446655440000',
to: '81234567890',
expiry_minutes: 10
};
fetch(url, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success) {
console.log(`OTP sent! ID: ${result.data.otp_id}`);
// Verifikasi OTP (contoh: user memasukkan kode 123456)
return fetch('https://app.wacloud.id/api/v1/messages/verify-otp', {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone_number: '81234567890',
code: '123456'
})
});
}
})
.then(response => response.json())
.then(verifyResult => {
if (verifyResult.success) {
console.log('OTP verified successfully!');
} else {
console.error('Error:', verifyResult.error);
}
})
.catch(error => {
console.error('Error:', error);
});
Anda dapat menggunakan template OTP yang sudah dibuat untuk mengirim pesan OTP dengan format yang konsisten:
{
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "81234567890",
"template_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"expiry_minutes": 10
}
OTP dapat memiliki status berikut:
Kelola kontak WhatsApp melalui API. Dapatkan daftar kontak, cek nomor terdaftar, update kontak, dapatkan foto profil, blokir/unblokir kontak, dan kelola LIDs (Linked IDs).
Untuk mendapatkan daftar semua kontak untuk device tertentu dengan pagination:
Mendapatkan daftar semua kontak dengan pagination dan sorting.
Query Parameters:
limit (optional, default: 100) - Jumlah kontak yang dikembalikanoffset (optional, default: 0) - Offset untuk paginationsortBy (optional, default: 'id') - Field untuk sorting ('id' atau 'name')sortOrder (optional, default: 'asc') - Urutan sorting ('asc' atau 'desc')curl -X GET "https://app.wacloud.id/api/v1/devices/default/contacts?limit=100&offset=0&sortBy=name&sortOrder=asc" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
// Get all contacts
$apiKey = 'YOUR_API_KEY';
$session = 'default';
$url = 'https://app.wacloud.id/api/v1/devices/' . $session . '/contacts';
$params = [
'limit' => 100,
'offset' => 0,
'sortBy' => 'name',
'sortOrder' => 'asc'
];
$ch = curl_init($url . '?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
foreach ($data['data'] as $contact) {
echo "Contact: " . $contact['name'] . "\n";
}
}
import requests
api_key = 'YOUR_API_KEY'
session = 'default'
url = f'https://app.wacloud.id/api/v1/devices/{session}/contacts'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
params = {
'limit': 100,
'offset': 0,
'sortBy': 'name',
'sortOrder': 'asc'
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
data = response.json()
if data['success']:
for contact in data['data']:
print(f("Contact: {contact['name']}"))
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const session = 'default';
const url = `https://app.wacloud.id/api/v1/devices/${session}/contacts`;
axios.get(url, {
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
params: {
limit: 100,
offset: 0,
sortBy: 'name',
sortOrder: 'asc'
}
})
.then(response => {
if (response.data.success) {
response.data.data.forEach(contact => {
console.log(`Contact: ${contact.name}`);
});
}
})
.catch(error => console.error(error));
const apiKey = 'YOUR_API_KEY';
const session = 'default';
const url = `https://app.wacloud.id/api/v1/devices/${session}/contacts`;
fetch(url + '?limit=100&offset=0&sortBy=name&sortOrder=asc', {
method: 'GET',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
data.data.forEach(contact => {
console.log(`Contact: ${contact.name}`);
});
}
})
.catch(error => console.error(error));
Mendapatkan informasi kontak tertentu. Contact ID bisa berupa nomor telepon (123123123) atau chat ID (123123@c.us atau 123123@lid).
curl -X GET "https://app.wacloud.id/api/v1/devices/default/contacts/123123123@c.us" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
$apiKey = 'YOUR_API_KEY';
$session = 'default';
$contactId = '123123123@c.us';
$url = 'https://app.wacloud.id/api/v1/devices/' . $session . '/contacts/' . $contactId;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
echo "Contact Name: " . $data['data']['name'] . "\n";
}
import requests
api_key = 'YOUR_API_KEY'
session = 'default'
contact_id = '123123123@c.us'
url = f'https://app.wacloud.id/api/v1/devices/{session}/contacts/{contact_id}'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
if data['success']:
print(f("Contact Name: {data['data']['name']}"))
Memperbarui informasi kontak di buku alamat telepon (dan di WhatsApp).
Request Body:
{
"firstName": "John",
"lastName": "Doe"
}
curl -X PUT "https://app.wacloud.id/api/v1/devices/default/contacts/123123123@c.us" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe"
}'
$apiKey = 'YOUR_API_KEY';
$session = 'default';
$chatId = '123123123@c.us';
$url = 'https://app.wacloud.id/api/v1/devices/' . $session . '/contacts/' . $chatId;
$data = [
'firstName' => 'John',
'lastName' => 'Doe'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Contact updated successfully\n";
}
import requests
api_key = 'YOUR_API_KEY'
session = 'default'
chat_id = '123123123@c.us'
url = f'https://app.wacloud.id/api/v1/devices/{session}/contacts/{chat_id}'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'firstName': 'John',
'lastName': 'Doe'
}
response = requests.put(url, headers=headers, json=data)
if response.status_code == 200:
result = response.json()
if result['success']:
print("Contact updated successfully")
Memeriksa apakah nomor telepon terdaftar di WhatsApp (bahkan jika nomor tidak ada di daftar kontak Anda).
Query Parameters:
phone (required) - Nomor telepon yang akan dicek (contoh: 11231231231)curl -X GET "https://app.wacloud.id/api/v1/devices/default/contacts/check-exists?phone=11231231231" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
$apiKey = 'YOUR_API_KEY';
$session = 'default';
$phone = '11231231231';
$url = 'https://app.wacloud.id/api/v1/devices/' . $session . '/contacts/check-exists?phone=' . $phone;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
if ($data['data']['numberExists']) {
echo "Number exists: " . $data['data']['chatId'] . "\n";
} else {
echo "Number does not exist\n";
}
}
import requests
api_key = 'YOUR_API_KEY'
session = 'default'
phone = '11231231231'
url = f'https://app.wacloud.id/api/v1/devices/{session}/contacts/check-exists'
headers = {
'X-Api-Key': api_key,
'Content-Type': 'application/json'
}
params = {
'phone': phone
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
data = response.json()
if data['success']:
if data['data']['numberExists']:
print(f("Number exists: {data['data']['chatId']}"))
else:
print("Number does not exist")
Mendapatkan foto profil kontak. Secara default, gambar di-cache selama 24 jam. Gunakan parameter refresh=true untuk memaksa refresh.
Query Parameters:
refresh (optional, default: false) - Paksa refresh gambarcurl -X GET "https://app.wacloud.id/api/v1/devices/default/contacts/123123123@c.us/profile-picture?refresh=false" \
-H "X-Api-Key: YOUR_API_KEY"
Memblokir kontak.
Membuka blokir kontak.
WhatsApp menggunakan identifier Linked ID (lid) untuk menyembunyikan nomor telepon pengguna dari grup publik. Gunakan API di bawah ini untuk memetakan LID ke nomor telepon.
Mendapatkan semua mapping LID ke nomor telepon untuk session.
Mendapatkan jumlah mapping LID yang diketahui untuk session.
Mendapatkan nomor telepon yang terkait dengan LID tertentu.
Mendapatkan LID untuk nomor telepon tertentu.
Daftar sekarang dan dapatkan akses ke API lengkap dengan paket gratis!
Daftar Sekarang