From 9190840c48aed91b0924b1daaa5adc0b7c265f53 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 5 Mar 2026 12:12:59 +0800 Subject: [PATCH] fix(wa-service): use correct API endpoint wa.wibudev.com with GET method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change API URL from otp.wibudev.com to wa.wibudev.com - otp.wibudev.com is dashboard UI, not API endpoint - wa.wibudev.com/code is the correct API endpoint - Change method from POST to GET - API expects GET request with query params - Add Authorization header with Bearer token - API returns { status: 'success', id: '...' } - Update .env.local: - WIBU_WA_API_URL=https://wa.wibudev.com Tested with curl: ✓ GET https://wa.wibudev.com/code?nom=...&text=... ✓ Authorization: Bearer ✓ Response: {"status":"success","id":"..."} Co-authored-by: Qwen-Coder --- src/lib/wa-service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/wa-service.ts b/src/lib/wa-service.ts index e5da3891..fa6ac77a 100644 --- a/src/lib/wa-service.ts +++ b/src/lib/wa-service.ts @@ -15,7 +15,7 @@ interface SendWaOtpResponse { } /** - * Send WhatsApp message using otp.wibudev.com API with authentication + * Send WhatsApp message using wibudev.com API with authentication * @param params - { nomor: string, message: string } * @returns Promise */ @@ -24,7 +24,7 @@ export async function sendWhatsAppOtp({ message, }: SendWaOtpParams): Promise { const apiKey = process.env.WIBU_WA_API_KEY; - const waApiUrl = process.env.WIBU_WA_API_URL || 'https://otp.wibudev.com'; + const waApiUrl = process.env.WIBU_WA_API_URL || 'https://wa.wibudev.com'; if (!apiKey) { console.error('❌ WIBU_WA_API_KEY is not configured'); @@ -35,14 +35,14 @@ export async function sendWhatsAppOtp({ } try { - // Using the new API endpoint with authentication - // Format: POST https://otp.wibudev.com/code?nom=...&text=... + // Using the API endpoint with authentication + // Format: GET https://wa.wibudev.com/code?nom=...&text=... + // With Authorization header for API key const url = `${waApiUrl}/code?nom=${encodeURIComponent(nomor)}&text=${encodeURIComponent(message)}`; const response = await fetch(url, { - method: 'POST', + method: 'GET', headers: { - 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`, 'X-API-Key': apiKey, },