WA Gateway
Login Dashboard
v1.0

WA Gateway API

Self-hosted WhatsApp API. Kirim pesan teks, gambar, dan file ke nomor WhatsApp manapun menggunakan HTTP request sederhana.

Base URL https://wa.amrzaki.my.id

Quick Start

1

Login ke Dashboard

Buka wa.amrzaki.my.id dan login menggunakan akun Google atau GitHub.

2

Tambah Device

Klik + Add Device, beri nama (misal: "Marketing"), lalu scan QR code menggunakan WhatsApp di HP kamu.
WhatsApp → Perangkat Tertaut → Tautkan Perangkat

3

Ambil API Key

Setelah device Connected, klik card device → klik Show lalu Copy API key.

4

Kirim Pesan Pertama

curl -X POST https://wa.amrzaki.my.id/api/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target":"6281234567890","message":"Hello!"}'

Authentication

Setiap request harus menyertakan API Key milik device di header Authorization.

Authorization: Bearer your_api_key_here

Atau via query parameter:

GET /api/send?token=your_api_key_here
Penting: Satu API Key hanya berlaku untuk satu device. Jika kamu punya beberapa nomor WhatsApp, setiap nomor punya API Key-nya sendiri.

Send Text Message

POST /api/send

Request Body

Parameter Type Required Description
targetstringrequiredNomor tujuan (format internasional)
messagestringrequiredIsi pesan teks
typestringoptionalDefault: text

Request

{
  "target": "6281234567890",
  "message": "Halo! Ini pesan dari WA Gateway 👋"
}

Response

{
  "success": true,
  "message_id": "550e8400-e29b-41d4-a716-446655440000",
  "wa_id": "3EB0C767D97B2C123456"
}

Send Image

POST /api/send
Parameter Type Required Description
targetstringrequiredNomor tujuan
typestringrequiredIsi: image
urlstringrequiredURL gambar (jpg, png, gif, webp)
captionstringoptionalTeks di bawah gambar
{
  "target": "6281234567890",
  "type": "image",
  "url": "https://example.com/gambar.jpg",
  "caption": "Ini caption gambarnya"
}

Send File / Document

POST /api/send
{
  "target": "6281234567890",
  "type": "document",
  "url": "https://example.com/laporan.pdf",
  "caption": "Laporan Bulan Ini"
}

Mendukung: PDF, DOCX, XLSX, ZIP, dan format file lainnya.

Message Logs

GET /api/messages/logs
Query Param Default Description
device_idID device (lihat di dashboard)
directionallinbound atau outbound
limit50Maks 200
offset0Untuk pagination
{
  "success": true,
  "messages": [
    {
      "id": "550e8400-...",
      "direction": "outbound",
      "to_number": "6281234567890",
      "type": "text",
      "content": "Halo!",
      "status": "sent",
      "created_at": 1745590800
    }
  ]
}

Webhook (Pesan Masuk)

Setiap pesan masuk akan dikirim via HTTP POST ke URL webhook yang kamu set di dashboard (klik device → isi Webhook URL → Save).

Payload yang diterima

{
  "event": "message",
  "device_id": "uuid-device-kamu",
  "from": "6281234567890",
  "type": "chat",
  "message": "Halo, saya mau tanya...",
  "timestamp": 1745590800000
}

Contoh handler webhook (Express.js)

app.post('/webhook/wa', (req, res) => {
  const { from, message, device_id } = req.body;
  console.log(`Pesan dari ${from}: ${message}`);

  // Balas otomatis
  if (message.toLowerCase() === 'halo') {
    sendWA(device_id, from, 'Halo juga! Ada yang bisa dibantu?');
  }

  res.json({ received: true });
});

JavaScript / Node.js

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://wa.amrzaki.my.id';

async function sendMessage(target, message) {
  const res = await fetch(`${BASE_URL}/api/send`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ target, message }),
  });
  return res.json();
}

// Kirim pesan
sendMessage('6281234567890', 'Halo dari Node.js! 👋')
  .then(console.log);

// Kirim gambar
async function sendImage(target, url, caption = '') {
  const res = await fetch(`${BASE_URL}/api/send`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ target, type: 'image', url, caption }),
  });
  return res.json();
}

PHP

<?php

function sendWhatsApp($target, $message, $apiKey) {
  $ch = curl_init('https://wa.amrzaki.my.id/api/send');
  curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
      "Authorization: Bearer {$apiKey}",
      'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
      'target'  => $target,
      'message' => $message,
    ]),
  ]);
  $result = json_decode(curl_exec($ch), true);
  curl_close($ch);
  return $result;
}

// Pemakaian
$response = sendWhatsApp(
  '6281234567890',
  'Notifikasi dari sistem kami!',
  'your_api_key_here'
);

if ($response['success']) {
  echo "Pesan terkirim: " . $response['message_id'];
}

Python

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://wa.amrzaki.my.id"

def send_message(target: str, message: str) -> dict:
  headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
  }
  payload = {"target": target, "message": message}
  res = requests.post(f"{BASE_URL}/api/send", json=payload, headers=headers)
  return res.json()

def send_image(target: str, url: str, caption: str = "") -> dict:
  headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
  }
  payload = {"target": target, "type": "image", "url": url, "caption": caption}
  res = requests.post(f"{BASE_URL}/api/send", json=payload, headers=headers)
  return res.json()

# Pemakaian
result = send_message("6281234567890", "Hello dari Python! 🐍")
print(result)

cURL

Kirim teks

curl -X POST https://wa.amrzaki.my.id/api/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target":"6281234567890","message":"Halo!"}'

Kirim gambar

curl -X POST https://wa.amrzaki.my.id/api/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target":"6281234567890","type":"image","url":"https://example.com/img.jpg","caption":"Lihat ini!"}'

Cek message logs

curl "https://wa.amrzaki.my.id/api/messages/logs?device_id=DEVICE_ID&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

Error Codes

HTTP Status Message Penyebab
401API key requiredHeader Authorization tidak ada
401Invalid API keyAPI key salah atau sudah di-regenerate
400Device not connectedWhatsApp device belum terhubung / scan QR
400target is requiredParameter target tidak ada di request body
500Internal server errorGagal kirim (nomor tidak valid, dll)

Format Nomor Telepon

Gunakan format internasional tanpa tanda plus (+) dan tanpa leading zero.

Format Contoh Status
Kode negara + nomor6281234567890✓ Benar
Dengan tanda ++6281234567890✗ Salah
Dengan leading 0081234567890✗ Salah