πŸ“– Konsep dasar

flodenotify adalah server notifikasi pub/sub: kamu kirim pesan ke sebuah topik, dan semua yang berlangganan topik itu (app HP, stream, Telegram) langsung menerimanya.

https://https://notif.kimlabs.id/<topik>          ← kirim pesan (POST)
https://https://notif.kimlabs.id/<topik>/json    ← baca/stream pesan

Topik dibuat otomatis saat pertama kali dipakai. Tiap topik milik user pembuatnya; user lain tidak bisa mengakses (kecuali admin).

πŸ”‘ Autentikasi β€” API key

Semua akses API wajib pakai API key (buat di Dashboard β†’ API Keys). Tiga cara:

# 1. Header Authorization
Authorization: Bearer flodenotify_xxxx

# 2. Header khusus
X-API-Key: flodenotify_xxxx

# 3. Query param (praktis untuk app ntfy)
https://https://notif.kimlabs.id/topik/json?apikey=flodenotify_xxxx

Login GUI web memakai session cookie β€” tidak perlu API key.

πŸ“€ Mengirim notifikasi

curl -H "Authorization: Bearer flodenotify_xxx" \
     -H "X-Title: Deploy Selesai" \
     -H "X-Priority: 4" \
     -H "X-Tags: rocket,deploy" \
     -d "Build v1.2.3 sukses di server produksi" \
     https://https://notif.kimlabs.id/deploy
HeaderIsiEfek
X-TitleteksJudul pesan (tampil tebal di Telegram)
X-Priority1–5⬇️1 Β· πŸ”Ή2 Β· (3 default) Β· ⚠️4 Β· 🚨5
X-Tagsdipisah komaTag/hashtag, mis. warning,rotating_light

Batas ukuran pesan 4 KB. Body kosong β†’ 400.

πŸ“₯ Menerima notifikasi

A. App ntfy di HP: Install ntfy β†’ Add subscription β†’ server https://https://notif.kimlabs.id β†’ topik kimnotif β†’ isi username & API key saat diminta.

B. Stream real-time:

curl -N -H "Authorization: Bearer flodenotify_xxx" https://https://notif.kimlabs.id/deploy/json

C. Poll riwayat:

curl -H "Authorization: Bearer flodenotify_xxx" "https://https://notif.kimlabs.id/deploy/json?poll=1"

Cache 200 pesan/topik, kadaluarsa 24 jam.

✈️ Telegram fan-out

  1. Admin isi bot_token di config.json, telegram.enabled: true, restart
  2. Chat bot dulu di Telegram (bot perlu tahu chat_id-mu)
  3. Dashboard β†’ Telegram β†’ pasangkan topik β†’ chat_id

Format MarkdownV2: judul tebal, tag = hashtag, prioritas β‰₯4 ⚠️, β‰₯5 🚨.

πŸ”Œ Contoh integrasi

bash / cron

DISK=$(df -h / | awk 'NR==2{print $5}')
curl -s -H "Authorization: Bearer flodenotify_xxx" \
     -H "X-Title: ⚠️ Disk Alert" -H "X-Priority: 4" \
     -d "Pemakaian disk: $DISK" \
     https://https://notif.kimlabs.id/server-alert

Python

import requests
requests.post("https://https://notif.kimlabs.id/bot-status",
    data="Hermes restart selesai",
    headers={"Authorization": "Bearer flodenotify_xxx",
             "X-Title": "πŸ€– Bot", "X-Tags": "robot"})

Google Apps Script

UrlFetchApp.fetch("https://https://notif.kimlabs.id/spreadsheet", {
  method: "post",
  payload: pesan,
  headers: { "Authorization": "Bearer flodenotify_xxx",
             "X-Title": "Sheet Update" }
});

n8n (HTTP Request node)

Method: POST   URL: https://https://notif.kimlabs.id/n8n-workflow
Headers:  Authorization: Bearer flodenotify_xxx
          X-Title: n8n Workflow
Body:     status workflow...

Node.js

await fetch("https://https://notif.kimlabs.id/app-event", {
  method: "post",
  body: "User baru: " + email,
  headers: { "Authorization": "Bearer flodenotify_xxx",
             "X-Title": "πŸ‘‹ User Baru" }
});

❓ Troubleshooting

401 butuh API keyKey salah/dicabut β€” cek Dashboard
403 topik bukan milik AndaTopik milik user lain
429Rate limit (120/menit) β€” tunggu sebentar
Tidak masuk TelegramPasangan topik→chat_id belum ada, atau bot belum di-Start
Stream terputusIdle timeout β€” client retry; riwayat via ?poll=1

πŸ” Keamanan ringkas

  • Password bcrypt + lockout 5 menit setelah 5Γ— gagal
  • API key bisa dicabut/dihapus kapan saja
  • Rate limit per user + audit log di Admin
  • HTTPS wajib (nginx + Let's Encrypt)