TUNGKAO ឯកសារ API
ចុចប៊ូតុង ហើយជ្រើស “Save as PDF”

TUNGKAO API

ផ្ញើអ៊ីមែល + OTP + SMTP

API v1 · ធ្វើបច្ចុប្បន្នភាពចុងក្រោយ: ម៉ោងប្រទេសថៃ (UTC+07:00)

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

ត្រូវបង្ហាញ “Powered by TUNGKAO” ភ្ជាប់ទៅ https://tungkao.com នៅលើទំព័រដែលប្រើសេវា

📧
API · email

ផ្ញើអ៊ីមែល + OTP + SMTP

ផ្ញើអ៊ីមែលពីគេហទំព័រតាម API ឬ SMTP (WordPress បាន) និង OTP តាមអ៊ីមែល — ប្ដូរអ្នកផ្ដល់ដោយស្វ័យប្រវត្តិ

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

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

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

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

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

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

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

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

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

Authorization: Bearer $TUNGKAO_KEY

📋 ជំហាន

  1. បង្កើត key អ៊ីមែល (key សាកល្បងផ្ញើបានតែទៅអាសយដ្ឋានអ្នក ៥០/ថ្ងៃ)
  2. SMTP: host smtp.tungkao.com ច្រក 587 (STARTTLS) ឬ 465 (SSL) ឈ្មោះអ្នកប្រើអ្វីក៏បាន ពាក្យសម្ងាត់ = API key
  3. API: ផ្ញើអ៊ីមែល ឬស្នើ OTP ហើយផ្ទៀងផ្ទាត់ដោយ otp_id (៥ ដង ប្រើម្ដង)

📡 ការហៅ API + គំរូកូដ

POST/v1/email/send
curl -X POST https://api.tungkao.com/v1/email/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":["[email protected]"],"subject":"Order #1001 confirmed","html":"<h1>Thanks for your order</h1>","text":"Thanks for your order","from_name":"My Shop","reply_to":"[email protected]"}'
POST/v1/email/otp/send
curl -X POST https://api.tungkao.com/v1/email/otp/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"[email protected]","brand":"My Shop","lang":"th","length":6,"ttl_seconds":300}'
POST/v1/email/otp/verify
curl -X POST https://api.tungkao.com/v1/email/otp/verify \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"otp_id":"8f6c2a1e-…","code":"123456"}'

📚 ឧទាហរណ៍ការប្រើ

ឧទាហរណ៍ 1

Order confirmation email

ស្ថានការណ៍: A customer completes an order

សំណើ
POST /v1/email/send
{
  "to": [
    "[email protected]"
  ],
  "subject": "Order #1001 confirmed",
  "html": "<h1>Thanks for your order</h1>",
  "text": "Thanks for your order",
  "from_name": "My Shop",
  "reply_to": "[email protected]"
}

➡️ Always send html and text; replies go to reply_to

ឧទាហរណ៍ 2

Send an email OTP

ស្ថានការណ៍: A new sign-up must confirm their email

សំណើ
POST /v1/email/otp/send
{
  "to": "[email protected]",
  "brand": "My Shop",
  "lang": "th",
  "length": 6,
  "ttl_seconds": 300
}
ឧទាហរណ៍ចម្លើយ
{
  "success": true,
  "data": {
    "otp_id": "8f6c2a1e-…"
  }
}

➡️ Keep otp_id; the code expires in 5 minutes

ឧទាហរណ៍ 3

Check the OTP

ស្ថានការណ៍: The user types the 6-digit code

សំណើ
POST /v1/email/otp/verify
{
  "otp_id": "8f6c2a1e-…",
  "code": "123456"
}

➡️ Correct = email confirmed · too many wrong tries = code locked, send a new one

ឧទាហរណ៍ 4

Send to several people

ស្ថានការណ៍: Tell three staff about a large order

សំណើ
POST /v1/email/send
{
  "to": [
    "[email protected]",
    "[email protected]",
    "[email protected]"
  ],
  "subject": "Large order #1002",
  "text": "Order #1002: 25,000 THB"
}

➡️ Everyone listed receives the email

ឧទាហរណ៍ 5

Review sent emails

ស្ថានការណ៍: A customer says the email never arrived

សំណើ
GET /v1/email/messages

➡️ Check the delivery status of each email

💡 បន្ថែម

📜 ប្រវត្តិបច្ចុប្បន្នភាព 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)
    error.user_message: ready-to-show text for end users on outages, no credits or key problems (white-label keys omit tungkao.com)
  3. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    GET /status៖ ស្ថានភាព API តាមសេវា (មិនត្រូវការ key)
  4. ថ្មី ម៉ោងប្រទេសថៃ (UTC+07:00)
    បើកសេវាអ៊ីមែល៖ API + SMTP + OTP
  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)
    រយៈពេល API key ការជូនដំណឹង និងការបន្ត — key ដដែល
  11. បន្ថែម ម៉ោងប្រទេសថៃ (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