TUNGKAO API docs
Press the button and choose “Save as PDF” as the destination

TUNGKAO API

Discord notifications

API v1 · Last updated: Thailand time (UTC+07:00)

https://tungkao.com · https://api.tungkao.com/docs

You must show a visible “Powered by TUNGKAO” (or “Secured by TUNGKAO” for login/payments) credit linking to https://tungkao.com on pages that use the service, as required by the terms

API · discord_notify

Discord notifications

Post messages into your or your customers' Discord channels — e.g. new orders for your team.

🕒 Last updated: Thailand time (UTC+07:00) · ✅ Your existing code keeps working

🤖 Let an AI write the integration

Copy this link for an AI to read (the whole API as Markdown), or press a button: the prompt is copied and the AI opens — paste it and tell it your language/framework

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

This link returns this API's updates as JSON (no key, any origin). Have your admin page show it as an “Update announcements” box and flag “New” when last_updated changes

Copy + open in: pressing an AI button copies the prompt automatically — if the chat box is empty, just paste

🔑 Key to use

Create a discord_notify key in the merchant portal (API keys) and send this header with every request — keys of other services won't work here

Authorization: Bearer $TUNGKAO_KEY

📋 How it works

  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.

📡 API calls + code examples

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"}'

📚 Usage examples

Example 1

Register a Discord channel

Situation: You want new orders posted in #orders

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

➡️ Name it once with ref and use it forever

Example 2

Post a new order

Situation: Order #1001 for 590 THB comes in

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

➡️ The message appears in the channel right away

Example 3

Custom sender name

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

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

➡️ The message shows Shop Bot as the sender

Example 4

Post to several channels

Situation: Notify both the admin and the stock channels

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

➡️ Posted to every listed channel

Example 5

Check sending history

Situation: You want to see which messages failed

Request
GET /v1/discord/messages

➡️ Returns each message with its status

📜 Update history of this API

  1. Added Thailand time (UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. Docs Thailand time (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. Added Thailand time (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. Added Thailand time (UTC+07:00)
    GET /status: per-service API status 🟢 normal / 🟠 high traffic / 🔴 minor delays (no key needed)
  5. Added Thailand time (UTC+07:00)
    Key on/off switch with status-change time + one key per service per website
  6. Improved Thailand time (UTC+07:00)
    API v1 frozen (additive only) + X-Tungkao-Api-Version header + 12-month deprecation notices
  7. Docs Thailand time (UTC+07:00)
    Per-API docs pages with AI links (ChatGPT / Claude / Gemini / Grok) in 10 languages
  8. Security Thailand time (UTC+07:00)
    Domain verification per API key (1 key = 1 site) — existing keys keep working
  9. Added Thailand time (UTC+07:00)
    Optional HMAC request signing — nothing changes unless you turn it on
  10. New Thailand time (UTC+07:00)
    Launched Telegram and Discord notifications
  11. Added Thailand time (UTC+07:00)
    API key lifetimes, expiry warnings and renewal — the key string never changes
  12. Added Thailand time (UTC+07:00)
    Test-mode keys (simulated, free) for every service

✅ Your existing code keeps working

🛡️ Stability promise: integrate once, keep working

🚦 System status (GET /status)

Check any time whether the API is healthy — no key needed

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"
  }
}

🏷️ TUNGKAO attribution requirement

Powered by TUNGKAO