TUNGKAO API docs
API · telegram_notify

Telegram notifications

Message your users on Telegram through TUNGKAO's bot — no bot of your own. E.g. payment received, order status, OTP.

🕒 Last updated: Thailand time (UTC+07:00) · ✅ Your existing code keeps working

🤖 Let an AI write the integration

Copy this link for an AI to read (the whole API as Markdown), or press a button: the prompt is copied and the AI opens — paste it and tell it your language/framework

https://app.tungkao.com/docs/api/telegram_notify.md?lang=en
https://api.tungkao.com/changelog/telegram_notify.json

This link returns this API's updates as JSON (no key, any origin). Have your admin page show it as an “Update announcements” box and flag “New” when last_updated changes

Copy + open in: pressing an AI button copies the prompt automatically — if the chat box is empty, just paste

🔑 Key to use

Create a telegram_notify key in the merchant portal (API keys) and send this header with every request — keys of other services won't work here

Authorization: Bearer $TUNGKAO_KEY

📋 How it works

  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.

📡 API calls + code examples

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"

📚 Usage examples

Example 1

Let a member connect Telegram

Situation: Member member-1001 wants notifications on Telegram

Request
POST /v1/telegram/link
{
  "ref": "member-1001"
}
Sample response
{
  "success": true,
  "data": {
    "url": "https://t.me/…?start=…"
  }
}

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

Example 2

Notify a payment

Situation: 500 THB arrived and you want to notify the member

Request
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

Example 3

Message with a link button

Situation: You want a button to open the order

Request
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

Example 4

Notify several members at once

Situation: Announce a promotion to three members

Request
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

Example 5

A member stops notifications

Situation: The member asks to disconnect

Request
DELETE /v1/telegram/recipients/member-1001

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

💡 More

📜 Update history of this API

  1. Added Thailand time (UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. Docs Thailand time (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. Added Thailand time (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. Added Thailand time (UTC+07:00)
    GET /status: per-service API status 🟢 normal / 🟠 high traffic / 🔴 minor delays (no key needed)
  5. Added Thailand time (UTC+07:00)
    Key on/off switch with status-change time + one key per service per website
  6. Improved Thailand time (UTC+07:00)
    API v1 frozen (additive only) + X-Tungkao-Api-Version header + 12-month deprecation notices
  7. Docs Thailand time (UTC+07:00)
    Per-API docs pages with AI links (ChatGPT / Claude / Gemini / Grok) in 10 languages
  8. Security Thailand time (UTC+07:00)
    Domain verification per API key (1 key = 1 site) — existing keys keep working
  9. Added Thailand time (UTC+07:00)
    Optional HMAC request signing — nothing changes unless you turn it on
  10. New Thailand time (UTC+07:00)
    Launched Telegram and Discord notifications
  11. Added Thailand time (UTC+07:00)
    API key lifetimes, expiry warnings and renewal — the key string never changes
  12. Added Thailand time (UTC+07:00)
    Test-mode keys (simulated, free) for every service

✅ Your existing code keeps working

🛡️ Stability promise: integrate once, keep working

🚦 System status (GET /status)

Check any time whether the API is healthy — no key needed

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 attribution requirement

Powered by TUNGKAO