# 1. طلب الروابط في الخلفية (Zero-Delay) احصل على روابط التحقق سراً وبدون تأخير قبل أن يضغط المستخدم على زر الدخول. --- نظام **ReOTP** مصمم لتقديم تجربة "الدخول بدون أرقام" (Zero-Type Auth). قم فقط بإرسال الطلب للحصول على روابط واتساب أو تيليجرام وسنقوم نحن بالتقاط رقم المستخدم من رسالته! ### المعاملات المرسلة (Request Body): - `apiKey` (نص - إجباري): مفتاح الـ API الخاص بمشروعك. - `phoneNumber` (نص - اختياري): رقم هاتف المستخدم (مثال: `+966500000000`). إذا لم يتم إرساله، سنلتقط الرقم تلقائياً من المُرسل. - `method` (نص - إجباري): يجب أن تكون `"WHATSAPP"` أو `"TELEGRAM"`. - `returnUrl` (نص - اختياري): رابط العودة بعد النجاح في تيليجرام. ### المعاملات المستلمة (Response Body): - `requestId` (نص): معرف العملية لمتابعة الحالة. - `waLink` (نص): رابط الواتساب المجهز. - `tgLink` (نص): رابط تيليجرام المجهز. - `expectedText` (نص): نص الرسالة التلقائية. بمجرد استلامك لهذه الروابط، اربطها بأزرار الدخول، وعند ضغط المستخدم على الزر، سيتم فتح الواتساب أو تيليجرام بضغطة واحدة. ## Code Examples ### cURL (WhatsApp) ```javascript curl -X POST https://[your-domain.com]/api/verify/init \ -H "Content-Type: application/json" \ -d '{ "apiKey": "YOUR_API_KEY", "method": "WHATSAPP" }' ``` ### cURL (Telegram) ```javascript curl -X POST https://[your-domain.com]/api/verify/init \ -H "Content-Type: application/json" \ -d '{ "apiKey": "YOUR_API_KEY", "method": "TELEGRAM", "returnUrl": "https://your-app.com/success" }' ``` ### JavaScript ```javascript const initVerification = async () => { const res = await fetch("https://[your-domain.com]/api/verify/init", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ apiKey: "YOUR_API_KEY", method: "WHATSAPP", // Or "TELEGRAM" returnUrl: "https://your-app.com/success" // Optional for Telegram }) }); const data = await res.json(); if (data.requestId) { console.log("Success! Session ID:", data.requestId); // Redirect or open the link const destinationLink = data.waLink || data.tgLink; window.open(destinationLink, "_blank"); } }; ``` ### Node.js ```javascript const axios = require('axios'); axios.post('https://[your-domain.com]/api/verify/init', { apiKey: 'YOUR_API_KEY', method: 'WHATSAPP', // or 'TELEGRAM' returnUrl: 'https://your-app.com/success' }) .then(response => { console.log('Session ID:', response.data.requestId); console.log('Verification Link:', response.data.waLink || response.data.tgLink); }) .catch(error => { console.error('Error starting verification:', error); }); ``` ### Python ```javascript import requests payload = { "apiKey": "YOUR_API_KEY", "method": "WHATSAPP", # or "TELEGRAM" "returnUrl": "https://your-app.com/success" } response = requests.post( "https://[your-domain.com]/api/verify/init", json=payload ) data = response.json() print("Session ID:", data.get("requestId")) print("Link:", data.get("waLink") or data.get("tgLink")) ``` ## Interactive Demo Demo type: init Title: مثال تفاعلي لبدء التحقق See the live demo at: https://reotp.com/ar/docs/api-init