WapFlow OTP API Belgesi

Kendi WhatsApp numaranızdan doğrulama kodu gönderin ve doğrulayın. Tüm yanıtlar JSON'dur.

Temel adres: https://wapflow.net/api/otp/v1

Kimlik doğrulama

Her istekte Authorization: Bearer <anahtar> başlığını gönderin. Anahtarları WapFlow panelindeki WapFlow OTP sayfasından oluşturursunuz; canlı anahtarlar wfo_live_, test anahtarları wfo_test_ ile başlar. Anahtar yalnızca oluşturulurken bir kez gösterilir; güvenle saklayın ve yalnızca sunucu tarafında kullanın.

Başarılı yanıt { "success": true, ... }, hata yanıtı { "success": false, "error": { "code": "...", "message": "..." } } biçimindedir.

Kod gönder

POST/send

phone (zorunlu) alıcı numarasıdır. İsteğe bağlı: code_length (4–8, varsayılan panel ayarı), ttl (60–900 sn), lang (ör. tr, en) ve app_name. Verilmeyenler panel ayarlarından alınır.

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

Kodu doğrula

POST/verify

phone ve code zorunludur. request_id verirseniz o istek kontrol edilir; vermezseniz bu numaraya bu anahtarla gönderilmiş, süresi dolmamış en son kod. En fazla 5 yanlış denemeden sonra istek kilitlenir; doğrulanan kod tekrar kullanılamaz.

İstek
{ "request_id": "req_...", "phone": "905321234567", "code": "123456" }
Yanıt (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 }

Durum sorgula

GET/status/:request_id

İsteğin durumunu döndürür: queued, sent, delivered, read, failed, verified, expired.

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

Bağlantıyı test et

GET/me

Anahtarın geçerli olduğunu, paketinizi, bağlı hesap sayısını ve bu ayki kota kullanımını gösterir (WordPress eklentisindeki "Bağlantıyı test et" düğmesi bunu kullanır).

{ "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" }

Örnekler

Aşağıdaki örnekler kod gönderir ve ardından kullanıcının girdiği kodu doğrular. wfo_live_XXXX yerine kendi anahtarınızı yazın.

# 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

Hata kodları

HTTPKodAnlamı
400invalid_requestİstek gövdesi ya da parametreler geçersiz.
401invalid_keyAPI anahtarı geçersiz ya da iptal edilmiş.
402no_subscriptionBu hesapta WapFlow OTP aboneliği yok.
402subscription_expiredAboneliğin süresi dolmuş; yenileyin.
403sales_disabledHizmet geçici olarak kullanıma kapalı.
422invalid_phoneTelefon numarası geçersiz.
429rate_limitedHız sınırı aşıldı; yanıttaki retry_after saniye sonra tekrar deneyin.
429quota_exceededBu ayki kod kotası doldu.
429daily_limit_reachedBağlı WhatsApp hesaplarının günlük gönderim sınırına ulaşıldı; yanıttaki retry_after saniye sonra (ertesi gün 00:00, Türkiye saati) tekrar deneyin. Kota harcanmaz.
503no_account_connectedBağlı ve açık bir WhatsApp hesabı yok.
503send_failedMesaj gönderilemedi; kısa süre sonra tekrar deneyin.

Hız sınırları

Hesap ısınması ve günlük sınır

Test anahtarları

wfo_test_ ile başlayan anahtarlar WhatsApp'a mesaj göndermez ve kota harcamaz; yanıtta kodu test_code alanında döndürür. Gönderim ve hız kuralları canlı anahtarla aynıdır; aktif abonelik yine gereklidir. Canlıya geçerken yalnızca anahtarı değiştirin.

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

Telefon numarası biçimi

Güvenlik notları

WordPress eklentisi

  1. wapflow-otp.zip dosyasını indirin.
  2. WordPress yönetiminde Eklentiler → Yeni ekle → Eklenti yükle ile zip dosyasını yükleyip etkinleştirin.
  3. Eklenti ayarlarında WapFlow panelinden oluşturduğunuz API anahtarını yapıştırın.
  4. "Bağlantıyı test et" düğmesiyle anahtarı ve paketinizi doğrulayın.
  5. Önce test anahtarıyla deneyin, ardından canlı anahtarı girin.