How to build a Telegram alert bot
Glue the WebSocket stream to a Telegram bot in under 40 lines. The example sends a chat message every time a Stake Crash round goes above 10×. Swap the rule for any condition you care about — segment landings, multiplier thresholds, big wins.
1. Create the Telegram bot
Open @BotFather on Telegram, /newbot, follow the prompts, save the HTTP API token. Add the bot to a channel or group and grab the chat_id (use @RawDataBot to dump the chat info).
2. Define your trigger
A trigger is one boolean function (round) → should I notify? Keep it small; one bot per rule is easier than one bot with a config DSL.
def should_alert(round):
return (
round["game_id"] == "stake-crash"
and float(round["multiplier"]) >= 10.0
)3. The full script
import asyncio, json, os, httpx, websockets
TS_KEY = os.environ['TS_KEY']
BOT_TOKEN = os.environ['BOT_TOKEN']
CHAT_ID = os.environ['CHAT_ID']
TG_URL = f'https://api.telegram.org/bot{BOT_TOKEN}/sendMessage'
WS_URL = 'wss://api.trackersino.com/v1-beta/stream?games=stake-crash'
def should_alert(r):
return float(r['multiplier']) >= 10.0
def msg(r):
m = r['multiplier']; ts = r['finalized_at']
return f"🚀 Stake Crash hit <b>{m}×</b> at {ts}"
async def main():
async with httpx.AsyncClient() as http:
async for ws in websockets.connect(
WS_URL,
extra_headers=[('Authorization', f'Bearer {TS_KEY}')],
ping_interval=20,
):
try:
async for raw in ws:
r = json.loads(raw)
if should_alert(r):
await http.post(TG_URL, json={
'chat_id': CHAT_ID,
'text': msg(r),
'parse_mode': 'HTML',
})
except websockets.ConnectionClosed:
continue
asyncio.run(main())4. Run it
pip install websockets httpx — then `TS_KEY=… BOT_TOKEN=… CHAT_ID=… python bot.py`. The bot reconnects automatically when the stream drops.
5. Trigger ideas
Beyond "multiplier > X": only Crazy Time bonus segments (segment ∈ {cf,pa,ch,ct}); only Lightning Storm Storm Bonus (segment == "stb"); only rounds where total_amount > €N; only rounds for a specific game; consecutive losses across a window (state in localStorage).
Hosting tip
Run it on a cheap VPS (DigitalOcean droplet €4/mo, Hetzner €3/mo) or a Cloudflare Worker for the no-server path. Ping us on Telegram if you want a Dockerfile.
Open Telegram →