Skip to content

Telegram: the bot and the Mini App ​

Admins run the Telegram Mini App from the portal's Telegram page (People → Telegram): whether it is set up and open, how the bot is connected, the switches and banner customers see, and who uses it.

Setting the bot up, once ​

The bot and the Mini App are created in Telegram and configured in the API's environment; the portal then registers the bot with Telegram.

  1. Create the bot in @BotFather: /newbot and pick its @username. Then /newapp on that bot to create the Mini App; its URL is where the Mini App is served, by default the site's /tg/ (https://juamarkets.com/tg/), and its short name goes in the t.me/<bot>/<short name> links.
  2. Configure the API (operations: Deploying). The GitHub secrets TELEGRAM_BOT_TOKEN (BotFather's token: it signs every launch of the app, so it is server-only) and TELEGRAM_WEBHOOK_SECRET (openssl rand -hex 32), and the variables TELEGRAM_BOT_USERNAME and TELEGRAM_MINIAPP_SHORT_NAME. Where the app is served and where Telegram delivers updates default to the site's /tg/ and /api/webhooks/telegram. Deploy.
  3. Register the bot on the Telegram page (below). Run it again whenever a URL or the secret changes.

The Telegram page's Problems list says exactly which variable is missing or wrong when the setup is incomplete, and when Telegram delivers updates to another server.

The page ​

Overview tiles ​

  • Mini App: Open, Paused (staff switched it off) or Not set up (the bot's settings are incomplete).
  • Bot: Connected (with how many updates are waiting), Not registered, Elsewhere (the webhook points at another server), Errors (a recent delivery error, with Telegram's message), Unreachable, or Development.
  • Money: a reminder that Jua holds no money in Telegram.
  • People: Telegram accounts, and how many joined this week.

Switches ​

Platform settings, saved and audited like every other:

SwitchDefaultWhat it does
Mini App open (telegram.enabled)onOff pauses the Mini App: sign-in from Telegram is refused and the app says Jua is taking a break. Accounts and positions are kept
Bot messages (telegram.notifications)onThe bot messages customers who allowed it about their own fills, results, payments and account
Announcements in Telegram (telegram.announcements)offAnnouncements sent from the Announcements page also reach those chats, with an Open Jua button (their link is not passed on)

What customers see ​

Banner: a notice across the top of the Mini App, with a tone, and no link (the Mini App opens none). The markets the Mini App features are the ones featured on the site; Demo mode and the fee are the platform's (Settings).

The bot ​

The bot's @username and link, the Mini App link to copy, where it is served from, the webhook the API expects and whether its secret is set, and the webhook as Telegram has it (where it points, updates waiting, the last delivery error).

Register the bot registers the webhook, the bot's commands (/start, /help) and its menu button with Telegram (POST /api/admin/telegram/setup, audited as telegram.setup). The button is off, with the reason, until the bot's token and secret are set. Run it again whenever a URL or the secret changes, or when the page says the webhook points elsewhere.

People ​

Every Telegram account with its Jua account, language, whether the bot may message it, its TON wallet, and when it joined and was last seen; searchable by @username, name, Jua username or Telegram id. A row opens the customer's page in the portal.

Telegram's rules ​

Telegram allows only the TON blockchain inside a Mini App, bans links to other chains or off-Telegram crypto platforms, requires a real-money product to be legal where offered and adults-only, and forbids bot spam. Jua keeps them (TON only, no external links, 18+, the bot messages only people who allowed it and stops at the first block). Read Telegram's guidelines again before launch and after any notice from Telegram.

Real money in Telegram ​

Trading USDT on TON is switched on by the operator (TON_EXCHANGE_ADDRESS and the TON settings: The contracts). Until then the Mini App offers play credits and Demo, and says "No real money in Telegram yet". There is no TON treasury and no deposit or withdrawal to manage.

Jua Markets · Africa's prediction market.