Check internet speed from Telegram with a bot
A Telegram bot that checks internet speed can turn a recurring network check into a one-tap chat command. Send /speed, wait briefly, and receive download speed, upload speed, ping, and details of the selected test server. This is useful for checking an NBN connection, a fixed-wireless link, or the service running on a small office VPS without opening a full browser-based test.
The most important decision is where the measurement happens. A hosted bot tests the path from its server to a speed-test network, so it reports the hosting provider’s connection rather than the speed at your desk. To measure a household, run the tester on a router, NAS, mini PC, or Raspberry Pi and let the bot trigger that local agent.
Location matters in Australia. Sydney and Melbourne hosting generally reduces latency for eastern seaboard users, while customers in Brisbane, Adelaide, Perth, and regional areas can experience different round-trip times. NBN Co’s fixed-line plans, fixed-wireless services, and FTTP connections also behave differently during busy periods, so every result should identify its test location.
Before publishing the bot, decide who may use it, what records you retain, and how people opt out. The Privacy Act 1988 and Australian Privacy Principles apply when an organisation stores identifiable chat data, while the Spam Act 2003 matters if a user list is later used for promotional messaging. Keep the service narrow, transparent, and easy to shut down.
Choose the measurement that matches the claim
Start by defining what a successful reading should mean. Throughput shows how many megabits per second can be transferred, latency measures delay, and jitter reveals variation between replies. These numbers answer different questions, and a poor sample can reflect a busy endpoint rather than an underperforming broadband line.
Remote and household tests therefore need different labels. If the bot lives in an Australian VPS, call the result a server test and show the hosting provider. If a local device initiates each test, label it a home test and include the WAN type when known. Never imply that a number from a Sydney host represents an Adelaide household.
Large Telegram transfers can add their own delay, especially on mobile data. This Telegram file download guide explains the file-handling side of the chat, helping you separate a slow file transfer from a congested connection. The speed test should remain independent of Telegram’s servers and download cache.
Prepare a reliable test host
For a hosted bot, choose a small VPS with an Australian region, sufficient monthly data, and an IPv4 address. Local providers, international cloud platforms, and specialist Australian hosts can all work, but benchmark the actual route instead of trusting advertised bandwidth. A nearby host may have low latency even when its international transfer capacity is limited.
Use a clean Linux virtual machine with Python 3, Docker, and a non-root service account. The Ookla speedtest executable provides repeatable results, while the Python speedtest package is convenient inside an existing bot. Pin the chosen version, install it in a virtual environment, and confirm that DNS, system time, and outbound HTTPS connections work before involving Telegram.
Three deployment models make the measurement trade-off explicit:
| Measurement origin | What the result represents | Best fit | Main limitation |
|---|---|---|---|
| Remote VPS | The VPS-to-test-server route | Hosting checks and public status information | Does not represent a user’s home connection |
| Home gateway | The gateway or device to the test server | Household and office network checks | Requires always-on hardware and a protected agent |
| Phone-assisted | The phone’s current connection | Travel and mobile spot checks | Needs a separate workflow for every test |
Connect the bot to the speed-test code
Create the bot by opening Telegram’s BotFather, choosing /newbot, selecting a display name, and choosing a username that ends in bot. Save the returned access token in an environment variable or secret manager, never in source control. Restrict group access through BotFather’s privacy settings unless group testing is intentional.
In the Python handler for /speed, send a typing action, run the test outside the main event-handler thread, and return the formatted result. Limit each request to one or two attempts because the upload and download phases can consume substantial traffic. Applying a timeout of roughly two minutes also prevents a stalled endpoint from occupying the bot indefinitely.
Useful commands include /speed, /speed server, and /status, with the last command reporting when the local agent last checked in. Format throughput to one decimal place, latency in milliseconds, and include the UTC time, city, and sponsor of the selected endpoint. If a result fails, identify the failed phase and provide a retry command instead of exposing a stack trace or private host address.
Handle Australian networks and user privacy
Australian endpoint selection deserves special care. The nearest listed server may sit across a congested backbone, so offer options in Sydney, Melbourne, Brisbane, Adelaide, and Perth and record the choice rather than selecting one silently. ISPs such as Telstra, Optus, TPG, and Aussie Broadband can route traffic very differently, even for customers with similar NBN plans.
For a covered organisation, the Privacy Act 1988 requires attention to any personal information deliberately retained, including chat identifiers, IP addresses, timestamps, and command history. State the purpose before collection, restrict access to records, set short retention periods, and provide a deletion route. A household project should usually avoid retaining chat identifiers beyond the time needed to deliver a result.
Shared home servers sometimes carry unrelated household tools, so access boundaries should remain clear. If another application stores cardiovascular information, this blood pressure guide covers that separate subject, while the speed bot should receive only network measurements; latency is not a medical indicator.
Business and community deployments need further checks. Unsolicited bulk messages can engage the Spam Act 2003, so obtain consent and provide a simple opt-out before using the bot for announcements. If you provide an internet service to consumers, assess whether the Telecommunications Act 1997 and the Telecommunications Consumer Code apply. A personal monitoring bot normally does not become an internet service provider merely because it runs a speed test.
Compare useful outputs and safeguards
A useful result gives people context instead of a single flattering number. Keep the first set of fields concise:
- Download and upload throughput in Mbps
- Latency and, where available, jitter
- Test server city, sponsor, and distance
- Start time, duration, and measurement origin
- A plain-English quality label based on published thresholds
The service controls belong in a separate checklist:
- Keep the bot token in a secret store
- Apply per-user and per-chat rate limits
- Run tests asynchronously with strict timeouts
- Hide host names, stack traces, and private addresses
- Rotate secrets and expire logs on a schedule
Run at least three tests when a user requests troubleshooting rather than a quick check. Compare median throughput and the spread between runs, and describe any conclusion as a snapshot. Peak numbers can look excellent while packet loss or jitter makes video calls and remote work feel poor.
Set expectations around data use and fairness. Each full test may transfer several hundred megabytes, which matters on a metered mobile plan. Exclude cached downloads and internal traffic or disclose their influence, because they can change the measured route. Save raw output only when a user explicitly requests it for diagnosis.
Launch the bot with a clear routine
Run the bot as a systemd service or Docker container so it restarts after a reboot. Add health checks for the Telegram connection and speed-test dependencies, and keep a small operational log outside the bot process. For a household gateway, pair it with a scheduled local test and have the bot request the latest completed result rather than starting unlimited work from every chat.
Publish a short command guide for users: /start for consent and privacy details, /speed for a test, /server to choose an endpoint, and /stop to disable stored updates. A public bot should also show its operator name and a contact for removal. Test it from an NBN connection, a 5G phone, and café Wi-Fi so you can see how different routes appear.
Create the BotFather project today, add one real test to a private chat, and publish only after the result clearly identifies where and when it ran. Once that baseline works, share the command with the people who need it and monitor usage without turning their chat data into an advertising list.