✅ âš ī¸ ⚡ â„šī¸

{{ toast.title }}

{{ toast.message }}

âš ī¸ Gateway Offline - Unable to connect to {{ apiBaseUrl }}. Retrying in {{ reconnectCountdown }}s...
đŸĻ€

Maiki Gateway

v1.0 MVP

Go DB Access Layer & Webhook Gateway

🔒

Authentication Required

{{ authError }}

Webhooks 📡
{{ subscribers.length }}
{{ activeSubscribersCount }} Active
Payloads Ingested đŸ“Ļ
{{ payloads.length }}
Latest 50
Broadcast Sync ⚡
{{ pendingPayloadsCount }} Pending
{{ broadcastedPayloadsCount }} Sent
Gateway Target đŸŽ¯
Port 8899
{{ lastPingMs }}ms Ready
✕
📡

No Webhook Subscribers Found

{{ subSearch ? 'No subscribers match your search filter.' : 'Register webhook endpoints to receive automated data broadcasts.' }}

ID Name / Label Webhook Endpoint Status Created At Actions
#{{ sub.id }} {{ sub.name || 'Untitled Webhook' }}
{{ sub.endpoint }}
{{ sub.active ? 'Active' : 'Inactive' }} {{ formatDate(sub.created_at) }}
Showing latest {{ payloads.length }} ingested JSON payloads from payloads table.
đŸ“Ļ

No Payloads Ingested Yet

Use the Ingest Test Tool or send a GET /send request to ingest data.

#{{ p.id }} Source: {{ p.source }} {{ formatDate(p.created_at) }}
{{ p.broadcasted ? 'Broadcasted' : 'Pending Broadcast' }}

Simulate Ingestion Endpoint (GET /send)

Test ingesting JSON payloads into the database layer per the PRD specification.

Quick Templates:
Will call: GET /send?payload=...&source=...
📚 Dokumentasi & Panduan API
Buka di Halaman Penuh ↗

Maiki Gateway Integration Guide

Gunakan panduan ini untuk mengintegrasikan website atau sistem Anda dengan Maiki API Gateway. Semua interaksi diamankan dengan Bearer API Key yang divalidasi dengan hash SHA-256 di basis data MySQL.

Base URL Produksi: {{ apiBaseUrl }}

🚀 1. Alur Integrasi Cepat (Quickstart)

1

Buat API Key

Generate Master API Key di server via ./scripts/create_api_key.sh.

2

Daftarkan Webhook

Kirim POST /subscribe berisi endpoint URL yang akan menerima data.

3

Kirim & Broadcast

Kirim payload via GET /send atau notifikasi langsung via POST /notify.

đŸ’ģ 2. Contoh Kode Request API

A. Mendaftarkan Webhook Subscriber (POST /subscribe)
curl -X POST "{{ apiBaseUrl }}/subscribe" \
  -H "Authorization: Bearer {{ apiKey || 'sk_live_...' }}" \
  -H "Content-Type: application/json" \
  -d '{
    "endpoint": "https://myapp.com/webhook",
    "name": "Production Webhook"
  }'
B. Mengirim Notifikasi ke Single Receiver (POST /notify)
curl -X POST "{{ apiBaseUrl }}/notify" \
  -H "Authorization: Bearer {{ apiKey || 'sk_live_...' }}" \
  -H "Content-Type: application/json" \
  -d '{
    "endpoint": "https://specific-app.com/webhook",
    "payload": {
      "event": "invoice.paid",
      "amount": 500000,
      "currency": "IDR"
    }
  }'
C. Ingest Data & Trigger Broadcast Massal
# 1. Simpan payload ke DB (GET /send)
curl -X GET "{{ apiBaseUrl }}/send?payload=%7B%22event%22%3A%22user.signup%22%2C%22email%22%3A%22user%40test.com%22%7D&source=myapp" \
  -H "Authorization: Bearer {{ apiKey || 'sk_live_...' }}"

# 2. Kirim ke semua subscriber aktif (POST /broadcast)
curl -X POST "{{ apiBaseUrl }}/broadcast" \
  -H "Authorization: Bearer {{ apiKey || 'sk_live_...' }}"

📡 3. Cara Menerima Webhook di Sisi Server (PHP / Node.js)

PHP (Laravel / Native)
<?php
header('Content-Type: application/json');
$input = file_get_contents('php://input');
$data  = json_decode($input, true);

$payloadId = $data['payload_id'] ?? null;
$eventData = $data['data'] ?? [];

// Logika aplikasi...
error_log("Diterima webhook #$payloadId: " . json_encode($eventData));

http_response_code(200);
echo json_encode(['status' => 'received']);
?>
Node.js (Express)
const express = require('express');
const app = express();
app.use(express.json());

app.post('/webhook', (req, res) => {
  const { payload_id, source, data } = req.body;
  console.log(`Diterima webhook #${payload_id}:`, data);
  res.status(200).json({ status: 'received' });
});

app.listen(3000);

📋 4. Tabel Referensi Endpoint Lengkap

Endpoint Method Auth Deskripsi
/health GET Publik Cek ketersediaan dan latensi gateway.
/send?payload={JSON} GET Bearer Key Ingest payload JSON ke database MySQL.
/subscribe POST Bearer Key Daftarkan endpoint webhook baru.
/subscribers GET Bearer Key Ambil daftar seluruh webhook subscriber.
/unsubscribe POST Bearer Key Nonaktifkan subscriber webhook.
/broadcast POST Bearer Key Kirim broadcast asinkron ke semua webhook aktif.
/notify POST Bearer Key Kirim notifikasi langsung ke 1 receiver spesifik.
/payloads GET Bearer Key Ambil log 50 data payload terakhir.

➕ Register Webhook Subscriber

Must be an HTTP or HTTPS URL to receive broadcast POST dispatches.

🔑 Master API Key Configuration

The API Gateway requires an authorized Master API Key for all requests. The key is securely passed in the Authorization: Bearer header.

Default Development Key:
sk_live_7x9p2m4v8k1h5d3g