This pattern lets anyone message your bot, but only licensed users get full responses.Documentation Index
Fetch the complete documentation index at: https://docs.authforge.cc/llms.txt
Use this file to discover all available pages before exploring further.
Architecture
- User sends a message to your bot.
- If not licensed, bot asks for a license key.
- User submits key in DM/private chat.
- Bot validates key with AuthForge and sets
hwidOverride = tg:<telegram_user_id>. - If valid, store “licensed” status for that Telegram user.
Why this works
- AuthForge treats HWID as an identity string.
tg:<user_id>is stable per Telegram account.- Seat controls (
maxHwidSlots) and reset flows still work.
user_id, not username (usernames can change).
Use heartbeatMode: "LOCAL" (or heartbeat_mode="LOCAL" in Python) for the bot process. Server heartbeat mode targets software running on the licensee’s device; a Telegram bot only performs validation on your infrastructure, so local session checks after login are enough.
For every scheduled run or every message, use validateLicense / validate_license (same /auth/validate + Ed25519 verification as login) so you avoid heartbeat timers and never need logout() just to stop background intervals. Keep login for processes that intentionally hold one long-lived session.
Node example (Telegraf-style pseudocode)
Python example
Recommended bot behavior
- Keep key entry in private chat.
- Rate limit invalid attempts per user and per IP.
- Return clear error text for
invalid_key,expired,revoked,hwid_mismatch. - Provide a support command to request reset help when users switch accounts.