Telegram bot starter on Railway
python-telegram-bot, an async Python library for Telegram bots, as a webhook starter with Postgres on Railway.
python-telegram-bot is an open-source Python library for the Telegram Bot API. Since version 20 it is fully asynchronous and built on asyncio, and it supports both ways Telegram delivers updates to a bot: webhooks and polling. Its telegram.ext package adds handlers for commands and messages, and an optional job queue.
Developers use it for personal assistants, notification bots, support bots and small games. Webhooks suit an always-on bot but need a public HTTPS address and a secret, while polling works from any machine that can reach Telegram.
python-telegram-bot is distributed under the LGPL-3.0. Bots built with it must also follow Telegram's terms for bot developers.
What Telegram bot starter can do
- Async API on Python's asyncio
- Webhooks and polling for receiving updates
- Command and message handlers in telegram.ext
- Optional job queue for scheduled tasks
- Coverage of the Telegram Bot API types and methods
What people use it for
- Personal or team assistant bots
- Notifications from your own apps and services
- Customer support bots
- Small games and community bots
- Learning to write and deploy a Telegram bot in Python
Videos
Running Telegram bot starter on Railway
The Railway template is a starter bot on python-telegram-bot 22.8 and Python 3.13.18 behind an aiohttp server, with PostgreSQL 18.6 on the private network. At every start it sets its webhook to https://{your-domain}/telegram with a secret header, and it falls back to polling when the domain is missing or unreachable. Notes and reminders are stored in Postgres. Measured on Railway, the bot idled at about 60 MB of RAM and Postgres at about 110 MB.
Telegram bot starter templates on Railway
Tracklayer templates are listed first. Other Telegram bot starter templates follow, ordered by total deployments on Railway. How this works.
Deployment numbers as of 2026-11-25.
Questions about Telegram bot starter
Should a bot use webhooks or polling?
Webhooks are the efficient choice for an always-on bot with a public HTTPS address, because Telegram calls the bot when there is an update. Polling needs no public address. The Railway starter uses a webhook on its Railway domain and switches to polling if there is no domain.
Why does my bot stop answering when I start a second copy?
Telegram allows either one webhook or one poller per bot token. Run one deployment per token and use a separate test bot from @BotFather for local development.
Can I use a self-hosted Bot API server?
Yes. In the Railway starter, set TELEGRAM_API_URL to your server's URL; when it is empty the bot uses https://api.telegram.org.
What does the LGPL mean for my bot's code?
The starter installs python-telegram-bot unmodified from PyPI and uses it as a library, and the starter's own code is MIT. Changes to the library itself fall under the LGPL. Ask for legal advice if you plan to modify and distribute the library.
Is the template official?
No. It is a community template, not affiliated with Telegram, the python-telegram-bot project or Railway. Telegram is a trademark of Telegram Group Inc.
Guides
Similar apps
Tracklayer maintains the templates marked as such; Telegram bot starter is a trademark of its owners and this site is not affiliated with them.
