TUNGKAO Tài liệu API
Bấm nút rồi chọn “Lưu dưới dạng PDF”

TUNGKAO API

Thông báo Telegram

API v1 · Cập nhật lần cuối: Giờ Thái Lan (UTC+07:00)

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

Theo điều khoản, trang dùng dịch vụ phải hiển thị “Powered by TUNGKAO” (hoặc “Secured by TUNGKAO” cho đăng nhập/thanh toán) liên kết tới https://tungkao.com

API · telegram_notify

Thông báo Telegram

Nhắn tin Telegram cho người dùng qua bot của TUNGKAO — không cần bot riêng. Vd tiền về, trạng thái đơn, OTP.

🕒 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://api.tungkao.com/docs/api/telegram_notify.md?lang=vi
https://api.tungkao.com/changelog/telegram_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 telegram_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. ref is your own name for a recipient (use your member id, e.g. member-1001): A-Z a-z 0-9 _ . : @ - up to 128 chars. Every call refers to the recipient by this ref.
  2. Add a recipient: your server calls POST /v1/telegram/link {ref} → gets data.url (a t.me/…?start=… link) → show it as a “Connect Telegram” button on the member's profile page (valid 30 minutes, single use; request again any time).
  3. The member opens the link → presses Start in Telegram → the bot confirms (Telegram does not let a bot message someone who never pressed Start, so this step cannot be skipped).
  4. Check the connection: GET /v1/telegram/recipients (status = active) — use it to switch your button to “Connected ✓”.
  5. Send: POST /v1/telegram/send with one ref or up to 100 refs; bold text (parse_mode: HTML) and a link button are supported. Per-recipient results are in data.results: sent / not_linked / failed.
  6. Remove a recipient: DELETE /v1/telegram/recipients/{ref}. Members can also send /stop to the bot. If a member blocks the bot, that recipient is paused until they connect again.
  7. Try it without code: TUNGKAO API key page → this key's card → “Set up notifications” has a create-link button (with QR) and a send-test button.

📡 Gọi API + mã mẫu

POST/v1/telegram/link
curl -X POST https://api.tungkao.com/v1/telegram/link \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"member-1001"}'
POST/v1/telegram/send
curl -X POST https://api.tungkao.com/v1/telegram/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"member-1001","text":"<b>Payment received</b> 500 THB","parse_mode":"HTML","button":{"text":"View order","url":"https://yourshop.com/orders/1"}}'
GET/v1/telegram/messages
curl -X GET https://api.tungkao.com/v1/telegram/messages \
  -H "Authorization: Bearer $TUNGKAO_KEY"

📚 Ví dụ sử dụng

Ví dụ 1

Let a member connect Telegram

Tình huống: Member member-1001 wants notifications on Telegram

Yêu cầu
POST /v1/telegram/link
{
  "ref": "member-1001"
}
Phản hồi mẫu
{
  "success": true,
  "data": {
    "url": "https://t.me/…?start=…"
  }
}

➡️ Give the member the link to tap (valid 30 minutes, once)

Ví dụ 2

Notify a payment

Tình huống: 500 THB arrived and you want to notify the member

Yêu cầu
POST /v1/telegram/send
{
  "ref": "member-1001",
  "text": "<b>Payment received</b> 500 THB",
  "parse_mode": "HTML"
}

➡️ The member gets the message in Telegram right away

Ví dụ 3

Message with a link button

Tình huống: You want a button to open the order

Yêu cầu
POST /v1/telegram/send
{
  "ref": "member-1001",
  "text": "Order #1001 shipped",
  "button": {
    "text": "View order",
    "url": "https://yourshop.com/orders/1001"
  }
}

➡️ A button under the message opens the link

Ví dụ 4

Notify several members at once

Tình huống: Announce a promotion to three members

Yêu cầu
POST /v1/telegram/send
{
  "refs": [
    "member-1001",
    "member-1002",
    "member-1003"
  ],
  "text": "New promotion today"
}

➡️ Sent to each member; check results with GET /v1/telegram/messages

Ví dụ 5

A member stops notifications

Tình huống: The member asks to disconnect

Yêu cầu
DELETE /v1/telegram/recipients/member-1001

➡️ The link is removed; no more messages are sent

💡 Thêm

📜 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