TUNGKAO API ドキュメント
API · discord_notify

Discord 通知

自分やお客様の Discord チャンネルにメッセージを投稿 — 例:チームへの新規注文通知。

🕒 最終更新: タイ時間(UTC+07:00) · ✅ 既存のコードはそのまま動作

🤖 AI に連携コードを書かせる

このリンクを AI に渡すか(API 全体の Markdown)、ボタンを押すとプロンプトがコピーされ AI が開きます

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

このリンクはこの API の更新を JSON で返します(key 不要・どのドメインからも可)。管理画面に「更新のお知らせ」として表示し、last_updated が変わったら「新着」を付けてください

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

コピーして開く: AI ボタンでプロンプトが自動コピーされます。入力欄が空なら貼り付けてください

🔑 使うキー

加盟店ポータル(API key)で discord_notify キーを作成し、すべてのリクエストにこの header を送ります — 他サービスのキーはここでは使えません

Authorization: Bearer $TUNGKAO_KEY

📋 手順

  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 呼び出し + コード例

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

📚 使い方の例

例 1

Register a Discord channel

状況: You want new orders posted in #orders

リクエスト
POST /v1/discord/webhooks
{
  "ref": "orders-room",
  "url": "https://discord.com/api/webhooks/123/abc…"
}

➡️ Name it once with ref and use it forever

例 2

Post a new order

状況: Order #1001 for 590 THB comes in

リクエスト
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "🛒 New order #1001 — 590 THB"
}

➡️ The message appears in the channel right away

例 3

Custom sender name

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

リクエスト
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "Daily sales: 12,400 THB",
  "username": "Shop Bot"
}

➡️ The message shows Shop Bot as the sender

例 4

Post to several channels

状況: Notify both the admin and the stock channels

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

➡️ Posted to every listed channel

例 5

Check sending history

状況: You want to see which messages failed

リクエスト
GET /v1/discord/messages

➡️ Returns each message with its status

📜 この API の更新履歴

  1. 追加 タイ時間(UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. ドキュメント タイ時間(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. 追加 タイ時間(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. 追加 タイ時間(UTC+07:00)
    GET /status:サービス別の API ステータス(キー不要)
  5. 追加 タイ時間(UTC+07:00)
    キーのオン/オフと状態変更時刻 + 1 サイトにつきサービスごとに 1 キー
  6. 改善 タイ時間(UTC+07:00)
    API v1 を恒久固定(追加のみ)+ X-Tungkao-Api-Version header + 12 か月前の廃止予告
  7. ドキュメント タイ時間(UTC+07:00)
    API ごとのドキュメントと AI リンク(10 言語)
  8. セキュリティ タイ時間(UTC+07:00)
    API キーごとのドメイン認証(1 キー = 1 サイト)— 既存キーはそのまま動作
  9. 追加 タイ時間(UTC+07:00)
    任意の HMAC リクエスト署名 — オンにしなければ変化なし
  10. 新規 タイ時間(UTC+07:00)
    Telegram・Discord 通知を開始
  11. 追加 タイ時間(UTC+07:00)
    API キーの期限・期限前通知・更新 — キー文字列は変わらない
  12. 追加 タイ時間(UTC+07:00)
    全サービスに test モードキー(模擬・無料)

✅ 既存のコードはそのまま動作

🛡️ 安定性の約束:一度つなげばずっと動く

🚦 システム状況(GET /status)

API が正常かいつでも確認できます(キー不要)

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 クレジット表記の要件

Powered by TUNGKAO