TUNGKAO Tài liệu API
API · discord_notify

Thông báo Discord

Gửi tin vào kênh Discord của bạn hoặc khách — vd báo đơn mới cho đội.

🕒 Cập nhật lần cuối: Giờ Thái Lan (UTC+07:00) · ✅ Mã cũ vẫn chạy, không cần sửa

🤖 Nhờ AI viết mã tích hợp

Sao chép liên kết này cho AI đọc (toàn bộ API dạng Markdown) hoặc bấm nút: lời nhắc được sao chép và AI được mở

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

Liên kết này trả về các cập nhật của API dưới dạng JSON (không cần key, mọi nguồn). Hãy hiển thị trong trang quản trị như hộp “Thông báo cập nhật” và gắn “Mới” khi last_updated thay đổi

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

Sao chép + mở: Bấm nút AI sẽ tự sao chép lời nhắc — nếu ô chat trống, chỉ cần dán

🔑 Key cần dùng

Tạo key discord_notify trong cổng bán hàng (API key) và gửi header này với mọi yêu cầu — key của dịch vụ khác không dùng được ở đây

Authorization: Bearer $TUNGKAO_KEY

📋 Các bước

  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.

📡 Gọi API + mã mẫu

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

📚 Ví dụ sử dụng

Ví dụ 1

Register a Discord channel

Tình huống: You want new orders posted in #orders

Yêu cầu
POST /v1/discord/webhooks
{
  "ref": "orders-room",
  "url": "https://discord.com/api/webhooks/123/abc…"
}

➡️ Name it once with ref and use it forever

Ví dụ 2

Post a new order

Tình huống: Order #1001 for 590 THB comes in

Yêu cầu
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "🛒 New order #1001 — 590 THB"
}

➡️ The message appears in the channel right away

Ví dụ 3

Custom sender name

Tình huống: You want the sender to show as “Shop Bot”

Yêu cầu
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "Daily sales: 12,400 THB",
  "username": "Shop Bot"
}

➡️ The message shows Shop Bot as the sender

Ví dụ 4

Post to several channels

Tình huống: Notify both the admin and the stock channels

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

➡️ Posted to every listed channel

Ví dụ 5

Check sending history

Tình huống: You want to see which messages failed

Yêu cầu
GET /v1/discord/messages

➡️ Returns each message with its status

📜 Lịch sử cập nhật API này

  1. Bổ sung Giờ Thái Lan (UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. Tài liệu Giờ Thái Lan (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. Bổ sung Giờ Thái Lan (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. Bổ sung Giờ Thái Lan (UTC+07:00)
    GET /status: trạng thái API theo từng dịch vụ (không cần key)
  5. Bổ sung Giờ Thái Lan (UTC+07:00)
    Công tắc bật/tắt key kèm thời điểm đổi trạng thái + mỗi website 1 key cho mỗi dịch vụ
  6. Cải tiến Giờ Thái Lan (UTC+07:00)
    Khóa vĩnh viễn API v1 (chỉ bổ sung) + header X-Tungkao-Api-Version + báo ngừng trước 12 tháng
  7. Tài liệu Giờ Thái Lan (UTC+07:00)
    Trang tài liệu riêng cho từng API kèm liên kết AI (10 ngôn ngữ)
  8. Bảo mật Giờ Thái Lan (UTC+07:00)
    Xác minh tên miền cho từng API key (1 key = 1 site) — key cũ vẫn hoạt động
  9. Bổ sung Giờ Thái Lan (UTC+07:00)
    Ký yêu cầu HMAC tùy chọn — không bật thì không đổi gì
  10. Mới Giờ Thái Lan (UTC+07:00)
    Ra mắt thông báo Telegram và Discord
  11. Bổ sung Giờ Thái Lan (UTC+07:00)
    Thời hạn API key, nhắc hết hạn và gia hạn — chuỗi key không đổi
  12. Bổ sung Giờ Thái Lan (UTC+07:00)
    Key chế độ test (mô phỏng, miễn phí) cho mọi dịch vụ

✅ Mã cũ vẫn chạy, không cần sửa

🛡️ Cam kết ổn định: tích hợp một lần, chạy mãi

🚦 Trạng thái hệ thống (GET /status)

Kiểm tra API có bình thường không bất cứ lúc nào — không cần 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"
  }
}

🏷️ Yêu cầu ghi nguồn TUNGKAO

Powered by TUNGKAO