Integrations

Telegram bot

/_authed/bot configures the customer-facing storefront bot (and an optional second support bot) that most Telegram users interact with instead of the web panel. It has seven tabs: Main bot, Support bot, Features, Admin controls, Content, Broadcast, Direct message.

Data is fetched with api.bot.get() (→ BotSettings) and saved with api.bot.save(patch); api.bot.restart() restarts both bot processes ("Bot & panel restarting"). The top bar shows the auto-detected @username, a live status dot computed as data.running && data.enabled, the support bot handle if configured, any lastError banner, an "unsaved" badge when the form is dirty, and Restart / Save buttons.

Under the hood, the bot is a Python process (backend/agent/bot.py) that itself calls the same agent over HTTP as the panel (agent() helper hitting paths like /bot/...) — so bot actions and panel actions share one backend source of truth.

FieldMeaning
EnabledSwitch that turns the whole customer-facing bot on/off.
Bot tokenObtained from @BotFather; pasted directly (token field, plaintext — unlike the masked support token).
Admin chat IDReceives new-payment notifications. If empty, the first user to run /admin is auto-registered as the admin — the bootstrap mechanism for who holds bot-admin rights.
Log chat ID (optional)Server activity forwarding target. The bot must be admin of that channel/group; paste its numeric chat id (negative for groups/channels, e.g. -1001234567890).
Force-join channel / Community group@handles shown in the welcome message — implied required-to-join gates before using the bot.

Fields

Support bot token
Separate BotFather token. Leaving it empty and saving disables the support bot (falls back to routing everything through the main bot). Once saved, shows *** masked; you must type a new token to replace it.
Support bot username
Auto-detected on save; can be overridden for display.
Mechanics
Admin replies and support DMs route through this bot when configured; users tap a support link in the main bot to land here; if this bot is offline, messages fall back to the main bot automatically.

Reply mode (supportMode)

ModeBehavior
noneBot stays silent; tickets only land in the admin chat and the web Support page (pure inbox).
humanMessages are silently forwarded; optional one-time manualReplyText first-message line, or fully silent.
botBot immediately acknowledges with an ETA (botAckText, default text if blank, plus expectedReplyMinutes, default 15), then delivers the admin's real answer once typed in the Support page.

A "Forward user messages to admin" toggle is also present, likely controlling whether raw user messages are copied into the admin/log chat regardless of reply mode.

BotFeaturesCard controls a matrix of enable/disable feature flags. In bot.py, the feat(u, name) helper reads a bot_features map where a missing key means the feature is enabled by default — so this tab is an opt-out surface for individual bot capabilities rather than an opt-in one.

AdminControlsCard lets the admin manage admin-side access beyond the single bootstrap adminChatId set in the Main bot tab — i.e. the list of chat ids/permissions that can use the in-Telegram admin screens described in §10.9 below.

FieldMeaning
Welcome message (welcomeText)Supports placeholders {name}, {username}, {brand}; blank uses the default greeting built by _default_welcome (an HTML greeting using BRAND_NAME).
Welcome image / GIF URL (welcomeMedia)Sent above the welcome text on /start.
Payment instructions (paymentInstructions)Shown when a user picks a plan — bank/crypto/QRIS details etc.
Payment QR image URL (paymentQrUrl)QR code image shown alongside payment instructions.
Auto-delete sensitive messages (minutes) (autoDeleteMinutes)Default 10 — configs, payment details, and receipts self-delete from the chat after this many minutes.

BroadcastCard sends an announcement to all bot users — a general-purpose message blast, separate from the Gifts/Coupons broadcast mechanism used specifically for redeem/coupon codes (see the Gifts, codes, referrals page).

DirectMessageCard sends a one-off DM to a specific Telegram ID from this page — a convenience parallel to the DM action available on a user row in the Users page.

Registered top-level commands in backend/agent/bot.py (main bot):

CommandWhat it does
/startRoutes to user home or admin home depending on is_admin(); also carries referral deep-link payloads (ref=<code>).
/meShortcut to "my accounts" list (user_accounts).
/adminOpens the admin panel (admin_home); replies "Not authorized." if is_admin() is false.
/restoreAdmin only — prompts for an autoscript-backup-*.tar.gz file to restore a system backup.
/cancelClears any pending multi-step input state (awaiting, adm_await, order_id, topup_pending_id).
/doneFinalizes a multi-step flow (not detailed further in the source excerpt).
/helpLists /start, /me, and — if admin — /admin, /restore.
/redeemPrompts for and consumes a redeem code.
/couponPrompts for and consumes a coupon code.

On the separate support bot instance (when configured): /start, /cancel, /help are wired to the support conversation flow (support_cmd_start, support_cmd_cancel).

  • CallbackQueryHandler(on_button) — every inline-keyboard button tap.
  • on_photo / on_document — payment proof uploads and backup restores.
  • on_text — general text handler for multi-step prompts ("type amount", "type username", coupon/redeem code entry).
  • ChatMemberHandler (on_my_chat_member) — detects when the bot is added/removed as admin of a chat, feeding the "chats where bot is admin" list used by Gifts/Redeem broadcasting.
  • _admin_block_gate — an early TypeHandler gate (group -10) that runs before everything else, enforcing the Users-page block list.

These mirror web-panel functionality directly inside Telegram, reachable by an admin via /admin:

ScreenWhat it does
admin_home / admin_dashAdmin dashboard inside Telegram (stats, live connections).
admin_liveLive connections list.
admin_usageUsage/traffic browser with time-range paging.
admin_users / admin_user_detailBrowse users, view activity feed, adjust points (admin_user_points), reset trial (admin_user_reset_trial), DM a user (admin_user_dm).
admin_accounts / admin_account_show / admin_extend / admin_goBrowse accounts, extend expiry by N days, and confirm-then-execute actions like delete/reset via admin_confirm.

Same moderation, two surfaces

The same moderation actions available in the web Users/Payments pages (grant points, extend accounts, delete/reset accounts, DM users) are also reachable directly from Telegram by an admin, without opening the web panel.
  1. 1
    In Telegram, message @BotFather, run /newbot, follow the prompts to get a token like 123456:ABC-DEF....
  2. 2
    In the panel, go to Bot → Main bot.
  3. 3
    Paste the token into Bot token.
  4. 4
    Toggle Enabled on.
  5. 5
    Click Save (top-right sticky bar) — this restarts/reconnects the bot process with the new token.
  6. 6
    In Telegram, message your new bot and send /admin — since Admin chat ID is empty, you are auto-registered as the bot admin. Optionally copy your numeric chat id into Admin chat ID afterward to lock it in.
  7. 7
    Optionally set Force-join channel / Community group handles.
  8. 8
    Go to the Content tab to customize welcome text/image and payment instructions/QR before going live.
  9. 9
    Optionally go to the Support bot tab, create a second BotFather bot, paste its token, save, and choose a Reply mode.
  10. 10
    Click Restart any time the bot seems stuck or after major settings changes.
  11. 11
    A user now runs /start, browses Plans (see the Plans & pricing page), picks one, uploads a payment proof screenshot, and the order lands in Payments → Pending for you to approve — completing the first purchase.