A Telegram score bot is the fastest way to put live football data in front of real users: no app store, no hosting dashboard for your players — they just open a chat. This guide builds a working /score bot in Python that answers team lookups from real fixture data, and it is designed from the first line to stay inside a free API tier.
1. The budget that shapes the design
On KickoffAPI's Hobby plan (free, no card required) you get 100 requests per day. That number decides the architecture. A naive bot that polls fixtures every 30 seconds burns through 2,880 requests before lunch. A bot that only calls the API when a user asks, with a short cache, uses a handful. We build the second kind. If you later need push-style live updates, the polling cadences in our rate-limits deep dive apply directly.
2. Get a key and make your first call
Grab a free key, then verify your access from a terminal. Every v2 response uses one envelope: a data array plus a meta object with cursor pagination.
$ curl -G "https://api.kickoffapi.com/api/v2/fixtures" \
-d "limit=3" \
-H "x-api-key: $KICKOFF_API_KEY"
Two failure responses are worth memorising, because your bot will handle both:
{"error":"Missing x-api-key header for path: /api/v2/fixtures","code":"MISSING_API_KEY"}
{"error":"Invalid API key","code":"INVALID_API_KEY"}
3. A tiny client with a TTL cache
The cache is what keeps you inside 100 requests/day. Identical questions inside the TTL are answered from memory and cost nothing:
import time, requests
CACHE_TTL = 300 # 5 minutes
class Kickoff:
def __init__(self, key, cache_ttl=CACHE_TTL):
self.key = key
self.ttl = cache_ttl
self.cache = {}
def fixtures(self, limit=20):
now = time.time()
hit = self.cache.get("fixtures")
if hit and now - hit[0] < self.ttl:
return hit[1]
r = requests.get(
"https://api.kickoffapi.com/api/v2/fixtures",
params={"limit": limit},
headers={"x-api-key": self.key},
timeout=10,
)
r.raise_for_status()
data = r.json()["data"]
self.cache["fixtures"] = (now, data)
return data
4. The /score command
We filter client-side by team name so the example works on every plan and stays stable if the reference adds native filters — check the v2 reference for the current parameter list first:
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes
ko = Kickoff("YOUR_API_KEY")
def fmt(f):
return f"{f.get('homeTeam', {}).get('name', '?')} "
f"{f.get('score', {}).get('home', '-')}–{f.get('score', {}).get('away', '-')} "
f"{f.get('awayTeam', {}).get('name', '?')} ({f.get('status', '')})"
async def score(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
q = " ".join(ctx.args).lower()
if not q:
await update.message.reply_text("Usage: /score <team name>")
return
hits = [f for f in ko.fixtures(50)
if q in f.get("homeTeam", {}).get("name", "").lower()
or q in f.get("awayTeam", {}).get("name", "").lower()]
if not hits:
await update.message.reply_text("No fixture found for that team.")
return
await update.message.reply_text("\n".join(fmt(f) for f in hits[:5]))
app = Application.builder().token("TELEGRAM_BOT_TOKEN").build()
app.add_handler(CommandHandler("score", score))
app.run_polling()
Field names above follow the documented fixture shape — confirm them against the sandbox response on your plan before shipping, because exact casing can differ between endpoints.
5. Deploy and stay free
Any always-on Python host works. The maths that matter: a command costs one API call at most (usually zero, from cache), so 100 requests/day comfortably serves a small group chat. The bot itself runs on ~40 MB of RAM; a $4 VPS or the free tier of any container host is enough. Put the API key and bot token in environment variables, never in the file.
Summary
Free tier + on-demand commands + a five-minute cache is the whole trick. When your group outgrows pull-based updates, move live polling onto a paid plan and adopt the cadence table from our polling guide. Want the data without the code? The widget builder embeds live scores in minutes.