Referensi API WapFlow OTP

Kirim dan verifikasi kode verifikasi dari nomor WhatsApp Anda sendiri. Semua respons berformat JSON.

Base URL: https://wapflow.net/api/otp/v1

Autentikasi

Kirim header Authorization: Bearer <key> pada setiap permintaan. Anda membuat kunci di halaman WapFlow OTP pada panel WapFlow; kunci live diawali wfo_live_ dan kunci uji diawali wfo_test_. Kunci hanya ditampilkan sekali, saat dibuat — simpan dengan aman dan gunakan hanya di server Anda.

Respons sukses terlihat seperti { "success": true, ... }; respons error terlihat seperti { "success": false, "error": { "code": "...", "message": "..." } }.

Kirim kode

POST/send

phone (wajib) adalah nomor penerima. Opsional: code_length (4–8), ttl (60–900 dtk), lang (mis. tr, en) dan app_name. Parameter yang tidak Anda isi diambil dari pengaturan panel Anda.

Permintaan
{
  "phone": "905321234567",
  "code_length": 6,
  "ttl": 300,
  "lang": "tr",
  "app_name": "Acme"
}
Respons (200)
{
  "success": true,
  "request_id": "req_...",
  "phone": "905321234567",
  "expires_at": "2026-11-12T10:05:00.000Z",
  "status": "sent"            // "sent" | "queued"
}

Verifikasi kode

POST/verify

phone dan code wajib diisi. Dengan request_id, permintaan tersebut yang diperiksa; tanpa itu, kode terakhir yang belum kedaluwarsa dan dikirim ke nomor tersebut dengan kunci ini. Setelah 5 percobaan salah, permintaan dikunci, dan kode yang sudah terverifikasi tidak bisa dipakai ulang.

Permintaan
{ "request_id": "req_...", "phone": "905321234567", "code": "123456" }
Respons (200)
{ "success": true, "valid": true }

{ "success": true, "valid": false,
  "reason": "invalid_code",     // invalid_code | expired | too_many_attempts | already_verified | not_found
  "attempts_left": 3 }

Cek status

GET/status/:request_id

Mengembalikan status permintaan: queued, sent, delivered, read, failed, verified, atau expired.

{ "success": true, "request_id": "req_...", "status": "delivered",
  "sent_at": "...", "delivered_at": "...", "verified_at": null }

Uji koneksi

GET/me

Menampilkan bahwa kunci valid, paket Anda, jumlah akun yang terhubung, dan pemakaian kuota bulan ini (tombol "Uji koneksi" pada plugin WordPress menggunakannya).

{ "success": true, "plan": "otp-2",
  "accounts": { "limit": 2, "connected": 1 },
  "quota": { "monthly": 15000, "used": 42, "period": "2026-11" },
  "ends_at": "2026-12-12T10:00:00.000Z", "mode": "live" }

Contoh

Contoh-contoh ini mengirim kode lalu memverifikasi apa yang dimasukkan pengguna. Ganti wfo_live_XXXX dengan kunci Anda sendiri.

# 1) send
curl -X POST https://wapflow.net/api/otp/v1/send \
  -H "Authorization: Bearer wfo_live_XXXX" \
  -H "Content-Type: application/json" \
  -d '{"phone":"905321234567","app_name":"Acme"}'

# 2) verify
curl -X POST https://wapflow.net/api/otp/v1/verify \
  -H "Authorization: Bearer wfo_live_XXXX" \
  -H "Content-Type: application/json" \
  -d '{"request_id":"req_...","phone":"905321234567","code":"123456"}'
<?php
function wapflow_otp(string $path, array $body): array {
    $ch = curl_init('https://wapflow.net/api/otp/v1' . $path);
    curl_setopt_array($ch, [
        CURLOPT_POST => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 15,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('WAPFLOW_OTP_KEY'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => json_encode($body),
    ]);
    $res = json_decode(curl_exec($ch), true) ?: [];
    curl_close($ch);
    return $res;
}

$sent = wapflow_otp('/send', ['phone' => '905321234567', 'app_name' => 'Acme']);
// ... kullanıcı kodu girince:
$check = wapflow_otp('/verify', ['request_id' => $sent['request_id'], 'phone' => '905321234567', 'code' => $_POST['code']]);
if (!empty($check['valid'])) { /* giriş başarılı */ }
const BASE = 'https://wapflow.net/api/otp/v1';

async function otp(path, body) {
  const res = await fetch(BASE + path, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.WAPFLOW_OTP_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(body),
  });
  return res.json();
}

const sent = await otp('/send', { phone: '905321234567', app_name: 'Acme' });
// ... when the user submits the code:
const check = await otp('/verify', { request_id: sent.request_id, phone: '905321234567', code: '123456' });
if (check.valid) { /* signed in */ }
import os
import requests

BASE = "https://wapflow.net/api/otp/v1"
HEADERS = {"Authorization": "Bearer " + os.environ["WAPFLOW_OTP_KEY"]}

def otp(path, body):
    return requests.post(BASE + path, json=body, headers=HEADERS, timeout=15).json()

sent = otp("/send", {"phone": "905321234567", "app_name": "Acme"})
# ... when the user submits the code:
check = otp("/verify", {"request_id": sent["request_id"], "phone": "905321234567", "code": "123456"})
if check.get("valid"):
    pass  # signed in

Kode error

HTTPKodeArti
400invalid_requestIsi permintaan atau parameter tidak valid.
401invalid_keyKunci API tidak valid atau sudah dicabut.
402no_subscriptionAkun ini tidak memiliki langganan WapFlow OTP.
402subscription_expiredLangganan telah berakhir; silakan perpanjang.
403sales_disabledLayanan sementara tidak tersedia.
422invalid_phoneNomor telepon tidak valid.
429rate_limitedBatas laju terlampaui; coba lagi setelah retry_after detik yang ada di respons.
429quota_exceededKuota kode bulan ini sudah habis.
429daily_limit_reachedBatas pengiriman harian akun WhatsApp yang terhubung telah tercapai; coba lagi setelah jumlah detik retry_after dalam respons (keesokan hari pukul 00:00, waktu Istanbul). Kuota tidak terpakai.
503no_account_connectedTidak ada akun WhatsApp yang terhubung dan aktif.
503send_failedPesan tidak dapat dikirim; coba lagi sebentar lagi.

Batas laju

Pemanasan akun dan batas harian

Kunci uji

Kunci yang diawali wfo_test_ tidak mengirim pesan WhatsApp dan tidak memakai kuota; kode dikembalikan pada kolom test_code. Aturan pengiriman dan batas laju sama seperti kunci live, dan langganan aktif tetap diperlukan. Untuk beralih ke mode live, cukup ganti kuncinya.

{ "success": true, "request_id": "req_...", "status": "sent", "test_code": "482913" }

Format nomor telepon

Catatan keamanan

Plugin WordPress

  1. Unduh wapflow-otp.zip.
  2. Di admin WordPress, buka Plugin → Tambah Baru → Unggah Plugin, unggah file zip, lalu aktifkan.
  3. Di pengaturan plugin, tempelkan kunci API yang Anda buat di panel WapFlow.
  4. Gunakan tombol "Uji koneksi" untuk memeriksa kunci dan paket Anda.
  5. Coba dulu dengan kunci uji, lalu beralih ke kunci live.