A Sportsbook in a Telegram Mini App: How to Build a Betting App Inside the Messenger
How to launch a betting app right inside Telegram — no separate website, no app stores: a sportsbook widget, Telegram login, and bet placement and settlement through SportAPI.

A Telegram Mini App is a web app that opens right inside Telegram from a bot. For a betting project it is a way to launch without a separate website and without app store review: the user taps a button in the bot and sees the line, live matches, and a bet slip. SportAPI has everything such an app needs: a ready-made sportsbook widget with the line, live, and a bet slip, sports line data from $30 a month per sport, and a bet placement and settlement service from $300 a month. Your team handles users, balances, and licensing — or hands the whole project to turnkey development.
Why a Telegram Mini App suits a sportsbook
- No app stores. A Mini App is a web page, so updates ship instantly, without store review or store fees.
- Users are already in Telegram. No need to persuade anyone to install another app — they just open the bot.
- Password-free login. Telegram passes signed user data to the app, so sign-up is a single tap.
- Notifications out of the box. The bot tells users when a match starts, a bet wins, or odds change.
What a Mini App sportsbook is made of
| Component | What it does | Solution |
|---|---|---|
| Interface | Line, live, markets, bet slip | SportAPI sportsbook widget or your own interface on the line API |
| Sports data | Matches, odds, scores, statistics | SportAPI Sports Odds API |
| Bets and settlement | Accepting the slip, checking odds, settling winnings | SportAPI bet placement and settlement service |
| Login | Authorization with a Telegram account | initData verification on your server |
| Users and balance | Player accounts, deposits, and payouts | Your server and payment providers |
| Notifications | Wins, match starts, promotions | Your bot |
Step 1. The bot and the Mini App
- Create a bot with BotFather.
- Publish the app page at an HTTPS address — for example,
https://app.your-project.com. - Link it to the bot as a Mini App: create the app in BotFather or set a menu button with this address.
The bot now has a button that opens your app inside Telegram.
Step 2. The app page
A Mini App page is plain HTML. Telegram’s official script gives access to user data and window controls, and the SportAPI sportsbook widget provides the betting interface:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
<body>
<div id="sportsbook"><!-- paste the sportsbook widget embed code from the SportAPI manager here --></div>
<script>
const app = window.Telegram.WebApp;
app.ready();
app.expand(); // open the Mini App full screen
// send the Telegram-signed initData to your server for password-free login
fetch('/api/telegram-login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ initData: app.initData }),
});
</script>
</body>
</html>
The widget embed code — a container and a loader with your project’s parameters — comes from the SportAPI manager. The widget is built for mobile screens; open the demo inside Telegram before launch to check how it looks on your devices.
Step 3. Telegram login: verifying initData on the server
User data from initData must never be taken on trust — verify it on the server with the signature Telegram computes using your bot token. Verification in Python, following the official algorithm:
import hashlib
import hmac
import time
from urllib.parse import parse_qsl
def check_init_data(init_data, bot_token, max_age=3600):
"""Verifies the initData signature from a Telegram Mini App and returns the user data."""
data = dict(parse_qsl(init_data, keep_blank_values=True))
received_hash = data.pop("hash", "")
check_string = "\n".join(f"{key}={value}" for key, value in sorted(data.items()))
secret = hmac.new(b"WebAppData", bot_token.encode(), hashlib.sha256).digest()
expected = hmac.new(secret, check_string.encode(), hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, received_hash):
return None # signature mismatch — the request is forged
if time.time() - int(data.get("auth_date", 0)) > max_age:
return None # the data is too old
return data
If the signature is valid, create or find the player by their Telegram ID and pass a session token to the widget — the widget supports authorized users and notifies your site about events: login required, bet slip changed, balance updated.
Step 4. Accepting and settling bets
When a player confirms a slip in the widget, your server checks the balance and creates the bet through the SportAPI bet placement and settlement service:
- The slip is created from selection pointers in the line (
oc_pointer), and the system checks that the selections are open and the odds have not changed. - After the match the system settles every bet itself: win, loss, refund, half results.
- The outcome reaches your server through a settlement callback — you credit the winnings to the player’s balance.
- The bot messages the player: “Your bet won, +190 to your balance”.
You write neither the line interface nor the market settlement rules — only player and money accounting.
Notifications that bring players back
- The match is starting — for the player’s bets and favourite teams.
- The bet is settled — right after the callback, with the winnings.
- The odds changed — if the player follows the match.
Do not overdo it: 2–3 useful messages a day work better than dozens of promotional ones.
Licensing, payments, and platform rules
Accepting bets requires a license in the jurisdiction where you operate, player age and identity checks, and payment infrastructure. Telegram also has its own rules for Mini Apps and in-app payments — study them before launch. SportAPI provides the interface, data, and bet settlement but does not issue licenses or hold player wallets.
What it costs
| What you need | Cost |
|---|---|
| Sports line, prematch and live for one sport | from $30 a month |
| Bet placement and settlement | from $300 a month |
| Sportsbook widget | Connection terms from the manager |
| A complete betting platform | Turnkey development, on request |
| Testing before you pay | 2-day trial key, all sports |
Launch mistakes
- Trusting user data without checking the signature. Faking
initDataon the client is easy — verify it on the server only. - API keys on the page. The SportAPI key and settlement credentials live on the server only.
- A desktop interface. Mini Apps open on phones — test every screen on mobile.
- Launching without a license and platform rules. Settle legal questions before the first user.
- Spam messages. Players quickly block a bot that sends too much.
FAQ
Can I run a sportsbook in Telegram without a website?
Yes. A Mini App is a web page that Telegram opens inside the messenger. Players do not need a separate website, but you still need a server for users and bets.
Do I need to build the line interface from scratch?
No. The SportAPI sportsbook widget already includes the line, live, markets, and a bet slip, and embeds into a Mini App page.
How do users log in?
With their Telegram account: the app receives signed user data, your server verifies the signature and creates a session.
Who settles the bets?
The SportAPI bet placement and settlement service: it checks odds on acceptance, settles bets after the match, and sends the outcome to your server.
Can I order the whole thing turnkey?
Yes. SportAPI develops turnkey betting platforms — from the interface to the back office and integrations. Discuss the project with the manager.
What to do today
- Create a bot and publish an empty Mini App page.
- Ask the manager for trial access and the sportsbook widget code.
- Connect Telegram login with
initDataverification. - Connect bet placement and settlement and win notifications.
- Test the app on several phones inside Telegram.
Message the SportAPI manager on Telegram with what you want to launch as a Mini App — you will get trial access to the line, the widget code, or a turnkey development proposal.