TUNGKAO ឯកសារ API
API · discord_notify

ការជូនដំណឹងតាម Discord

ផ្ញើសារទៅឆានែល Discord របស់អ្នក ឬអតិថិជន — ឧ. ការបញ្ជាទិញថ្មីសម្រាប់ក្រុម

🕒 ធ្វើបច្ចុប្បន្នភាពចុងក្រោយ: ម៉ោងប្រទេសថៃ (UTC+07:00) · ✅ កូដចាស់នៅដំណើរការ មិនចាំបាច់កែ

🤖 ឱ្យ AI សរសេរកូដភ្ជាប់

ចម្លងតំណនេះឱ្យ AI អាន ឬចុចប៊ូតុង ប្រព័ន្ធនឹងចម្លងពាក្យបញ្ជា ហើយបើក AI

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

តំណនេះផ្ដល់បច្ចុប្បន្នភាពរបស់ API នេះជា JSON (មិនត្រូវការ key បើកពីគ្រប់ដែន)។ បង្ហាញក្នុងទំព័រគ្រប់គ្រងជាប្រអប់ “ប្រកាសបច្ចុប្បន្នភាព” ហើយដាក់ “ថ្មី” ពេល last_updated ប្ដូរ

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

ចម្លង + បើកក្នុង: ចុចប៊ូតុង AI ប្រព័ន្ធនឹងចម្លងពាក្យបញ្ជា បើប្រអប់ជជែកទទេ គ្រាន់តែបិទភ្ជាប់

🔑 key ដែលត្រូវប្រើ

បង្កើត key discord_notify នៅផតថលអាជីវករ (API key) ហើយផ្ញើ header នេះគ្រប់សំណើ — key សេវាផ្សេងមិនដំណើរការនៅទីនេះ

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 តាមសេវា (មិនត្រូវការ key)
  5. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    កុងតាក់បើក/បិទ key និងម៉ោងប្ដូរ + គេហទំព័រ 1 key 1 សម្រាប់សេវានីមួយៗ
  6. កែលម្អ ម៉ោងប្រទេសថៃ (UTC+07:00)
    ចាក់សោ API v1 ជាអចិន្ត្រៃយ៍ (បន្ថែមតែប៉ុណ្ណោះ) + header X-Tungkao-Api-Version + ជូនដំណឹងមុន 12 ខែ
  7. ឯកសារ ម៉ោងប្រទេសថៃ (UTC+07:00)
    ទំព័រឯកសារតាម API និងតំណ AI (10 ភាសា)
  8. សុវត្ថិភាព ម៉ោងប្រទេសថៃ (UTC+07:00)
    ផ្ទៀងផ្ទាត់ domain តាម API key (key 1 = គេហទំព័រ 1) — key ចាស់នៅដំណើរការ
  9. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    ចុះហត្ថលេខា HMAC ជាជម្រើស — មិនបើកក៏ដូចដើម
  10. ថ្មី ម៉ោងប្រទេសថៃ (UTC+07:00)
    បើកសេវាជូនដំណឹង Telegram និង Discord
  11. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    រយៈពេល API key ការជូនដំណឹង និងការបន្ត — key ដដែល
  12. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    key របៀប test (សាកល្បង ឥតគិតថ្លៃ) គ្រប់សេវា

✅ កូដចាស់នៅដំណើរការ មិនចាំបាច់កែ

🛡️ ការសន្យាស្ថិរភាព៖ ភ្ជាប់ម្ដង ប្រើបានជានិច្ច

🚦 ស្ថានភាពប្រព័ន្ធ (GET /status)

ពិនិត្យថា API ធម្មតាឬទេ គ្រប់ពេល — មិនត្រូវការ 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"
  }
}

🏷️ លក្ខខណ្ឌដាក់ក្រេឌីត TUNGKAO

Powered by TUNGKAO