Every security audit I run on a freshly launched AI Telegram bot turns up the same uncomfortable pattern. A developer grabs a weekend polling script, drops their master account API key into .env, wires incoming text straight into a chat completions endpoint, and invites the bot into a 400-member community group to gather feedback. Within an hour, someone forwards a 4,000-word PDF dump into the channel, another member tests a copy-pasted prompt injection payload to dump the system prompt, and a handful of bored users spam replies back-to-back until the shared wallet hits its ceiling and breaks an unrelated production app.
A Telegram bot wired to a language model is not a harmless chat toy. Architecturally, it is an unauthenticated public proxy sitting directly in front of your inference wallet. Anyone who knows the bot handle—or anyone sitting inside a group where the bot has been added—can trigger billable token generation on demand unless you place strict identity, rate, context, and credential boundaries between Telegram and your LLM gateway.
At the same time, engineers evaluating TOP AI often overlook a practical resource sitting right inside their dashboard: the monthly 1,000 TP Telegram community reward (at 1 TP = Rp 1, or roughly $0.0000625 per TP at Rp 16,000/USD). Verified server-side via @topai_bot, that recurring free credit alone funds roughly 840 real assistant turns on DeepSeek V4.1 Flash—more than enough runway to test webhook authentication, streaming UX, and multi-model failover without spending out of pocket on day one.
This TOP AI Telegram reward and AI bot tutorial walks through both layers end to end. In Part 1, we cover the exact mechanics of linking your account at /dashboard/telegram, passing server-side getChatMember verification on @topaichat and @topaicom, claiming 1,000 TP per UTC calendar month, and working cleanly with the session-authenticated /api/telegram API. In Part 2, we design and ship a production-hardened Telegram AI bot on https://topai.id/v1/chat/completions: provisioning a daily-capped tp- key at /dashboard/kunci, benchmarking reply capacity per 10,000 TP across four TOP AI models (deepseek-v4-1-flash, glm-5-3, kimi-k3, and claude-sonnet-5-5), locking down webhook and group-chat attack surfaces, and deploying complete TypeScript (Next.js App Router) and Python (FastAPI + python-telegram-bot) webhook handlers verified with cURL.
Fast Operational Summary: Part 1 links your account in /dashboard/telegram via a 15-minute single-use deep link to
@topai_bot, verifies membership in@topaichatand@topaicomserver-side usinggetChatMember, and credits 1,000 TP once per UTC month (YYYY-MM) instantly. Part 2 isolates your own bot behind a scoped, daily-cappedtp-key callinghttps://topai.id/v1/chat/completions, validatesX-Telegram-Bot-Api-Secret-Tokenin constant time, applies per-chat_idrate limits, capsmax_tokens <= 800with 6-turn rolling memory, renders typing and throttled progressive edits, and fails over automatically fromdeepseek-v4-1-flashtoglm-5-3.
Separating Human Identity Flows from Automated Bot Traffic
If you have not created your TOP AI account yet, start at /daftar and run your first inference check using our TOP AI quickstart tutorial covering signup, API keys, and first request. Once your account is active, the single most important architectural habit to adopt is keeping human account workflows completely separated from machine bot traffic.
TOP AI itself enforces this boundary cleanly across the platform. Your personal Telegram reward link uses @topai_bot, authenticates exclusively with your browser session cookie (topai_sesi), and proves real community membership in @topaichat and @topaicom. Your production AI bot, on the other hand, runs under a completely separate Telegram bot token you register through @BotFather, authenticates incoming webhooks with a 32-byte cryptographic secret header, and authenticates outbound inference calls to TOP AI with a dedicated, quota-capped tp- key. Neither plane ever touches the other's credentials.

Trace the trust boundaries in the diagram above. Every step crossing from Telegram into your own infrastructure passes through explicit verification before a single billable token is generated. Even if you already operate a full FinOps ledger as outlined in our TOP AI balance top-up and real-time TP cost monitoring tutorial, isolating Telegram traffic behind its own key and middleware shield keeps blast radius near zero when public chat traffic behaves unpredictably.
Part 1: Linking Your Account & Claiming the Monthly 1,000 TP Telegram Community Reward
Most reward widgets on developer platforms rely on fragile client-side redirects—click a button, open a tab, return, and receive points whether you actually joined the community or closed the tab two seconds later. TOP AI avoids that theater entirely. Every membership check runs server-side against Telegram's getChatMember Bot API method, backed by real-time chat_member webhook events and scheduled sweeps documented in /en/docs.
Step-by-Step Claim Flow Through /dashboard/telegram
Completing the initial binding and first claim takes under two minutes:
- Open the Telegram dashboard: Sign in to TOP AI and open /dashboard/telegram. Confirm your login session is active.
- Generate a one-time deep link: Click Hubungkan (Connect). TOP AI generates a cryptographically random, single-use token embedded inside a deep link targeting
@topai_bot(https://t.me/topai_bot?start=<one-time-token>). - Complete handshaking inside Telegram: Clicking the link opens
@topai_botin your Telegram client. Tap Start. Telegram delivers/start <token>to TOP AI's backend webhook, which validates the token, consumes it immediately so it cannot be replayed, binds your numerictelegramId1-to-1 to your TOP AI account, and replies inside Telegram confirming the link. - Join both official community spaces: Join the official discussion group
@topaichatand subscribe to the official announcements channel@topaicomusing the links shown on the dashboard. Both memberships are required. - Trigger server-side verification: Return to
/dashboard/telegramand click Periksa keanggotaan (Check Membership). The server queries Telegram'sgetChatMemberagainst both@topaichatand@topaicomto confirm your status is an active member state (member,administrator, orcreator). - Claim your monthly credit: Once both membership indicators turn green, click Klaim (Claim). The default 1,000 TP reward credits instantly to your prepaid Top Points balance, ready immediately for
/v1/chat/completions,/v1/messages, or Playground runs.
One operational detail worth noting: each deep link expires after 15 minutes and becomes invalid after a single use. That short window limits exposure if you accidentally paste a link into a shared scratchpad or screenshot. If the 15-minute window elapses before you tap Start, return to /dashboard/telegram and click Connect again—regenerating links is completely free with unlimited retries.
Official Reward Rules & 1-to-1 Account Integrity Policy
The governance rules below govern every monthly community reward cycle and are enforced directly in TOP AI's database layer:
| Policy Rule | Enforced Platform Specification | Practical Impact for Users & Security |
|---|---|---|
| Claim cadence | Once per UTC calendar month (YYYY-MM) | Rollover resets at 00:00 UTC on the 1st of each month, independent of local timezone offsets. |
| Eligibility criteria | Linked Telegram ID + active member of @topaichat + subscriber of @topaicom | All three states are validated server-side through getChatMember; leaving either space sets bisaKlaim: false. |
| Default reward value | 1,000 TP (1 TP = Rp 1, admin-configurable default) | Instant prepaid credit with zero expiration date and zero minimum spend requirement. |
| TOP AI to Telegram ratio | Strictly 1 Telegram account per TOP AI account | Prevents rotating disposable Telegram handles through one wallet without explicit unlinking. |
| Telegram to TOP AI ratio | Strictly 1 TOP AI account per telegramId | Eliminates multi-account reward farming from a single Telegram identity. |
| Leaving group/channel later | Zero clawback on previously claimed TP | Past rewards stay permanently in your balance; leaving only pauses claims for future YYYY-MM cycles until you rejoin. |
| Deep link lifetime | 15 minutes, single-use cryptographic token | Unlimited free regenerations if a link times out before tapping Start. |
| Verification authority | Server-side getChatMember + live chat_member updates | Immune to client-side DOM tampering, forged browser clicks, or replayed frontend payloads. |
The no-clawback policy is a clean design choice for engineering teams. If you spend your 1,000 TP testing a staging prompt and later leave the group temporarily, your wallet never drops into a negative balance—the system simply pauses next month's eligibility until both memberships are active again.
Inspecting & Calling /api/telegram (Session-Authenticated Endpoint)
Unlike inference endpoints (POST /v1/chat/completions) or balance checks (GET /v1/balance), /api/telegram does not accept Authorization: Bearer tp-... keys. It requires your authenticated browser session cookie (topai_sesi=<session-token>). From a security standpoint, this prevents a compromised backend tp- key from tampering with your human Telegram binding or invoking account-level actions.
If you are inspecting your binding state from a terminal during debugging with an active session cookie, a GET request returns both live membership telemetry and current platform configuration:
# Inspect current Telegram binding, membership flags, and UTC period eligibility
curl -s https://topai.id/api/telegram \
-H "Cookie: topai_sesi=<your-session-token>"Typical JSON response payload:
{
"status": {
"terhubung": true,
"telegramId": "555001",
"username": "demo_tg",
"diGrup": true,
"diChannel": true,
"bisaKlaim": true,
"sudahKlaim": false,
"rewardGp": 1000,
"periode": "2026-11"
},
"konfig": {
"aktif": true,
"botUsername": "topai_bot",
"grup": "@topaichat",
"channel": "@topaicom"
}
}State transitions execute via POST /api/telegram with a JSON body specifying aksi:
# Execute a monthly reward claim for the active YYYY-MM UTC cycle
curl -s -X POST https://topai.id/api/telegram \
-H "Cookie: topai_sesi=<your-session-token>" \
-H "Content-Type: application/json" \
-d '{ "aksi": "klaim" }'The table below catalogs all four supported aksi values alongside the exact HTTP error responses returned by /api/telegram:
| Action / HTTP Code | Payload Action or Error Message | Server Behavior & Resolution Path |
|---|---|---|
aksi: "tautan" | POST /api/telegram | Issues a fresh 15-minute single-use deep link targeting @topai_bot. Safe to call repeatedly if an earlier link expired. |
aksi: "cek" | POST /api/telegram | Forces an immediate server-side getChatMember check against @topaichat and @topaicom, updating diGrup and diChannel. |
aksi: "klaim" | POST /api/telegram | Verifies active UTC period (YYYY-MM) eligibility and atomically credits the period's reward (default 1,000 TP) to your wallet. |
aksi: "lepas" | POST /api/telegram | Unbinds your current telegramId from your TOP AI account if you need to migrate to a different Telegram account. |
HTTP 400 | Bot Telegram belum dikonfigurasi admin | Platform bot token has not been configured yet in admin settings (staging/maintenance state). |
HTTP 400 | Akun Telegram belum ditautkan | You have not tapped Start inside @topai_bot via a valid deep link yet. Trigger aksi: "tautan" again. |
HTTP 400 | Anda belum bergabung di grup Telegram | Server getChatMember check did not find your ID in @topaichat. Join the group, then trigger aksi: "cek". |
HTTP 400 | Anda belum berlangganan channel Telegram | Server getChatMember check did not find your ID subscribed to @topaicom. Subscribe, then trigger aksi: "cek". |
HTTP 400 | Reward periode ... sudah diklaim | A claim for this UTC YYYY-MM period already succeeded; wait for the next UTC calendar month rollover. |
HTTP 401 | Sesi tidak valid | Your topai_sesi cookie has expired or is missing. Re-authenticate via the TOP AI web dashboard. |
For platform operators reading the admin mechanics in the TOP AI Telegram documentation (/admin/telegram), four operational constraints apply equally when you build your own Telegram verification or community bot: the bot must hold administrator permissions inside the target group and channel or getChatMember fails; Group Privacy must be disabled inside @BotFather if the bot needs to inspect group commands reliably; Telegram rejects non-HTTPS or localhost webhooks outright; and because chat_member updates only fire for state changes after the bot joins, maintaining accurate state for pre-existing members requires a periodic batch verification job (TOP AI's /api/telegram/verifikasi cron endpoint sweeps up to 200 least-recently-checked accounts per invocation authenticated via x-telegram-cron).
Part 2: Architecting & Hardening a Production Telegram AI Bot on TOP AI API
Once your wallet holds starter TP—whether from the free 1,000 TP monthly reward or a prepaid top-up—you are ready to build your own AI-powered Telegram bot. This is where governance separates hobby scripts from resilient services.
Step 1: Mint a Scoped tp- API Key with a Hard Daily TP Cap
Before writing a single line of bot code, open /dashboard/kunci and provision a dedicated tp- key exclusively for your Telegram bot (for example, prod-tg-assistant-bot). Never reuse the key powering your web app, CI jobs, or coding editors. Configure three defensive controls on that key immediately:
- Enforce a hard daily TP ceiling: During staging or reward-funded prototyping, cap the key at
1,500 TPto5,000 TPper day. In production, size the daily cap to normal peak traffic plus 30% headroom (such as25,000 TPor50,000 TP). If a runaway retry loop or coordinated spam wave strikes at 2:00 AM, TOP AI cuts off that single key cleanly without draining the rest of your organization's prepaid balance. - Lock down the model allowlist: Restrict the key strictly to the models your bot actually routes to—typically
deepseek-v4-1-flashandglm-5-3for general chat, pluskimi-k3orclaude-sonnet-5-5only if you implement explicitly gated escalation commands. Even if an engineer accidentally commits the key to a private repo or leaks a container environment dump, nobody can burn balance on unapproved frontier reasoning or image-generation models. - Wire key rotation and audit trails: If you manage multi-team bots or client deployments, follow our full blueprint in enterprise AI API key governance: daily caps, allowlists, and audit logs so revocation takes one click and zero downtime.
Step 2: Model Reply Capacity per 10,000 TP & Tiered Routing Economics
Live TOP AI API Pricing for Models Mentioned
Frequently Asked Questions
What happens if my 15-minute @topai_bot linking URL expires before I tap Start?+
Nothing breaks and no balance is charged. The one-time deep link expires after 15 minutes strictly to reduce session-hijacking exposure, and you can generate a fresh link inside /dashboard/telegram an unlimited number of times for free.
Does leaving @topaichat or @topaicom reverse the 1,000 TP I already claimed?+
No. TOP AI never claws back previously credited rewards. Leaving the official group or unsubscribing from the channel simply pauses eligibility for the next UTC calendar month (YYYY-MM) until you rejoin and run a membership check.
Can one Telegram account claim the monthly reward across multiple TOP AI accounts?+
No. Account linking enforces a strict 1-to-1 invariant in the database: one TOP AI account binds to at most one Telegram ID, and one Telegram ID binds to at most one TOP AI account. Membership status is checked server-side through Telegram getChatMember.
How many real bot conversations can the free 1,000 TP monthly reward fund?+
At 1 TP = Rp 1 (~$0.0000625 USD), 10,000 TP funds roughly 8,400 replies on DeepSeek V4.1 Flash or 6,200 replies on GLM-5.3. That means a single 1,000 TP monthly community claim covers around 840 real assistant turns on Flash or over 600 turns on GLM-5.3—plenty to test prompts, webhooks, and fallback flows before funding a top-up.








