TUNGKAO Dokumentasi API
API · discord_notify

Notifikasi Discord

Kirim pesan ke kanal Discord Anda atau pelanggan — mis. pesanan baru untuk tim.

🕒 Terakhir diperbarui: Waktu Thailand (UTC+07:00) · ✅ Kode lama tetap berjalan

🤖 Minta AI menulis integrasinya

Salin tautan ini untuk dibaca AI (seluruh API dalam Markdown) atau tekan tombol: prompt disalin dan AI dibuka

https://app.tungkao.com/docs/api/discord_notify.md?lang=id
https://api.tungkao.com/changelog/discord_notify.json

Tautan ini mengembalikan pembaruan API ini sebagai JSON (tanpa key, dari asal mana pun). Tampilkan di halaman admin sebagai kotak “Pengumuman pembaruan” dan tandai “Baru” saat last_updated berubah

Salin + buka di: Menekan tombol AI otomatis menyalin prompt — jika kotak chat kosong, tinggal tempel

🔑 Key yang dipakai

Buat key discord_notify di portal merchant (API key) dan kirim header ini di setiap request — key layanan lain tidak berfungsi di sini

Authorization: Bearer $TUNGKAO_KEY

📋 Langkah

  1. Create a channel webhook in Discord (needs Manage Webhooks): desktop right-click the channel → Edit Channel → Integrations → Webhooks → New Webhook → name it → Copy Webhook URL (mobile: long-press the channel → Edit Channel).
  2. ref is your own name for the channel, e.g. orders-room (A-Z a-z 0-9 _ . : @ - up to 128 chars). One key can hold many channels, each with its own ref.
  3. Add a channel: POST /v1/discord/webhooks {ref, url} — url must start with https://discord.com/api/webhooks/…; it is stored encrypted and never returned. Posting the same ref again replaces that channel's link.
  4. Send: POST /v1/discord/send {ref, text} (up to 2000 chars; @everyone / @here are disabled automatically). Results are in data.results: sent / not_linked / failed.
  5. List channels: GET /v1/discord/recipients. Remove: DELETE /v1/discord/recipients/{ref}. If the webhook is deleted in Discord, the channel is paused and the undelivered message is refunded.
  6. Try it without code: TUNGKAO API key page → this key's card → “Set up notifications”: paste the webhook link, add the channel and send a test.
  7. Do not confuse this with the key's “Webhook URL” setting: that is your server address for receiving events from TUNGKAO, not a Discord channel link.

📡 Panggilan API + contoh kode

POST/v1/discord/webhooks
curl -X POST https://api.tungkao.com/v1/discord/webhooks \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"orders-room","url":"https://discord.com/api/webhooks/123/abc…"}'
POST/v1/discord/send
curl -X POST https://api.tungkao.com/v1/discord/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"orders-room","text":"🛒 New order #1001 — 590 THB"}'

📚 Contoh penggunaan

Contoh 1

Register a Discord channel

Situasi: You want new orders posted in #orders

Permintaan
POST /v1/discord/webhooks
{
  "ref": "orders-room",
  "url": "https://discord.com/api/webhooks/123/abc…"
}

➡️ Name it once with ref and use it forever

Contoh 2

Post a new order

Situasi: Order #1001 for 590 THB comes in

Permintaan
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "🛒 New order #1001 — 590 THB"
}

➡️ The message appears in the channel right away

Contoh 3

Custom sender name

Situasi: You want the sender to show as “Shop Bot”

Permintaan
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "Daily sales: 12,400 THB",
  "username": "Shop Bot"
}

➡️ The message shows Shop Bot as the sender

Contoh 4

Post to several channels

Situasi: Notify both the admin and the stock channels

Permintaan
POST /v1/discord/send
{
  "refs": [
    "admin-room",
    "stock-room"
  ],
  "text": "Stock low: T-shirt size M"
}

➡️ Posted to every listed channel

Contoh 5

Check sending history

Situasi: You want to see which messages failed

Permintaan
GET /v1/discord/messages

➡️ Returns each message with its status

📜 Riwayat pembaruan API ini

  1. Ditambah Waktu Thailand (UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. Dokumen Waktu Thailand (UTC+07:00)
    Telegram / Discord notifications: step-by-step setup guide on the key card and in the docs (Telegram connect link, add a Discord channel webhook)
  3. Ditambah Waktu Thailand (UTC+07:00)
    error.user_message: ready-to-show text for end users on outages, no credits or key problems (white-label keys omit tungkao.com)
  4. Ditambah Waktu Thailand (UTC+07:00)
    GET /status: status API per layanan (tanpa key)
  5. Ditambah Waktu Thailand (UTC+07:00)
    Sakelar on/off key dengan waktu perubahan + satu key per layanan per situs
  6. Ditingkatkan Waktu Thailand (UTC+07:00)
    API v1 dibekukan permanen (hanya penambahan) + header X-Tungkao-Api-Version + pemberitahuan penghentian 12 bulan
  7. Dokumen Waktu Thailand (UTC+07:00)
    Halaman dokumen per API dengan tautan AI (10 bahasa)
  8. Keamanan Waktu Thailand (UTC+07:00)
    Verifikasi domain per API key (1 key = 1 situs) — key lama tetap berfungsi
  9. Ditambah Waktu Thailand (UTC+07:00)
    Tanda tangan request HMAC opsional — tidak ada yang berubah jika tidak diaktifkan
  10. Baru Waktu Thailand (UTC+07:00)
    Meluncurkan notifikasi Telegram dan Discord
  11. Ditambah Waktu Thailand (UTC+07:00)
    Masa berlaku API key, pengingat, dan perpanjangan — string key tidak berubah
  12. Ditambah Waktu Thailand (UTC+07:00)
    Key mode test (simulasi, gratis) untuk semua layanan

✅ Kode lama tetap berjalan

🛡️ Janji stabilitas: integrasi sekali, terus berjalan

🚦 Status sistem (GET /status)

Cek kapan saja apakah API normal — tanpa key

GET https://api.tungkao.com/status

curl https://api.tungkao.com/status
{
  "success": true,
  "data": {
    "status": "ok",
    "services": [
      { "id": "slip_verify", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "slip_deposit", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "login", "status": "ok" },
      { "id": "telegram", "status": "ok" },
      { "id": "discord", "status": "ok" },
      { "id": "email", "status": "busy" },
      { "id": "crypto", "status": "ok" },
      { "id": "core", "status": "ok" }
    ],
    "paused": [],
    "updated_at": "2026-11-14T12:00:00.000Z"
  }
}

🏷️ Ketentuan mencantumkan kredit TUNGKAO

Powered by TUNGKAO