Host your Telegram bot for free on FPS.ms with Python or Node.js. Upload your code, set up dependencies, and your bot runs 24/7 — no credit card required. This guide walks you through the full setup for both languages.
Prerequisites
Before you start, make sure you have:- An FPS.ms account — create your first server and select a Telegram bot package (Python or Node.js)
- A Telegram bot token — follow our creating your bot with BotFather guide if you don't have one yet
- Your bot code ready to upload
Python or Node.js?
Python with python-telegram-bot is the most popular choice for Telegram bots. Node.js with Telegraf or grammY is a great option if you already know JavaScript. Both run 24/7 on FPS.ms for free.
Python setup
FPS.ms runs your Python bot by executingapp.py as the entry point by default. Follow these steps to get your bot online.
1. Create your main file
Create a file namedapp.py — this is the file FPS.ms runs when your server starts. You can change the entry point filename in the Startup tab if needed.
Important
Your main file must be named
app.py (or whatever you set in the Startup tab). Without it, you will see the error: /usr/local/bin/python: can't open file '/home/container/app.py': [Errno 2] No such file or directorypython-telegram-bot library:
app.py
import os
from dotenv import load_dotenv
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
load_dotenv()
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text('Hello! I am your bot running on FPS.ms.')
async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text('Available commands:\n/start - Start the bot\n/help - Show this message')
def main():
app = ApplicationBuilder().token(os.environ['BOT_TOKEN']).build()
app.add_handler(CommandHandler('start', start))
app.add_handler(CommandHandler('help', help_command))
print('Bot is running...')
app.run_polling()
if __name__ == '__main__':
main()
Security
Never hardcode your bot token directly in your code. Store it in a
.env file instead — see our environment variables guide to set this up on FPS.ms.2. Add your dependencies
Create arequirements.txt file listing the Python packages your bot needs. FPS.ms installs these automatically when your server starts.
requirements.txt
python-telegram-bot
python-dotenv
requirements.txt.
Important
Without a
requirements.txt or packages listed in the Startup tab, your bot will crash with ModuleNotFoundError. List every package your bot imports.3. Create your .env file
Create a.env file in the root directory with your bot token:
.env
BOT_TOKEN=your-telegram-bot-token-here
4. Upload and start
- Upload
app.py,requirements.txt, and.envto your server via the Files tab in the panel or through SFTP - Click Start on the Console tab
Bot is running... in the console when it starts successfully. Open Telegram and send /start to your bot to test it.
Node.js setup
FPS.ms runs your Node.js bot by executing the start script defined inpackage.json. You have three ways to get your code onto the server.
Upload methods
| Method | Best for | How it works |
|---|---|---|
| **GitHub repository** | Active development | Enter your repo details in the **Startup** tab, then press **Reinstall Server** |
| **SFTP upload** | Large projects | Upload your project folder via [SFTP](/getting-started/connecting-to-sftp/) |
| **Panel file manager** | Quick edits | Create and edit files directly in the **Files** tab |
Important
Do not upload the
node_modules or .npm cache folders. FPS.ms generates these automatically from your package.json.- Go to the Startup tab on the panel
- Enter your Git Repo Address (e.g.,
https://github.com/yourname/your-bot) - Optionally set the Branch, Git Username, and Git Access Token (required for private repos)
- If you have existing files on the server, select all files and delete them first
- Click Reinstall Server to pull the code from GitHub
- Your repo will be pulled fresh on reinstall, and updated automatically on every restart if Auto Update is enabled
Clear files first
If you already have files on the server, delete them before reinstalling from GitHub. Otherwise the clone may fail because the directory is not empty.
1. Create your project files
Here is a working example using the Telegraf framework:package.json
{
"name": "my-telegram-bot",
"version": "1.0.0",
"description": "My Telegram bot hosted on FPS.ms",
"main": "index.js",
"scripts": {
"start": "node ."
},
"dependencies": {
"telegraf": "latest",
"dotenv": "latest"
}
}
index.js
require('dotenv').config();
const { Telegraf } = require('telegraf');
const bot = new Telegraf(process.env.BOT_TOKEN);
bot.start((ctx) => ctx.reply('Hello! I am your bot running on FPS.ms.'));
bot.help((ctx) => ctx.reply('Available commands:\n/start - Start the bot\n/help - Show this message'));
bot.launch();
console.log('Bot is running...');
// Graceful shutdown
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
2. Create your .env file and start
- Create a
.envfile with your bot token:BOT_TOKEN=your-token-here - Upload your project files using one of the methods above
- Click Start on the Console tab
npm install to install your dependencies, then starts your bot. You should see Bot is running... in the console.
Python vs Node.js comparison
| Feature | Python (python-telegram-bot) | Node.js (Telegraf) |
|---|---|---|
| Entry point | `app.py` (configurable in Startup) | `index.js` (configurable in Startup) |
| Dependencies | `requirements.txt` | `package.json` |
| Language | Python | JavaScript |
| Best for | Beginners, data processing bots | JS developers, webhook-based bots |
| Community size | Very large | Large |
| Async support | Built-in (asyncio) | Built-in (Promises) |
Polling vs webhooks
Telegram bots can receive updates in two ways:| Method | How it works | Best for |
|---|---|---|
| **Polling** | Your bot asks Telegram for new messages periodically | FPS.ms free hosting (recommended) |
| **Webhooks** | Telegram sends messages to your bot's URL | Paid hosting with a public URL |
Use polling on FPS.ms
Free FPS.ms servers don't have public URLs, so use polling mode. Both examples above use polling. If you upgrade to a paid plan with a domain, you can switch to webhooks for faster response times.
Next steps
Your bot is now running 24/7 on FPS.ms. Here is what to do next:- Edit your bot code — update files via the panel, SFTP, or VS Code live sync
- Set up environment variables — securely manage your bot token and config
- Add commands — make your bot interactive with custom commands
- Create a schedule — set up automatic restarts or timed tasks
- Upload files via SFTP — transfer files securely to your server
Troubleshooting
Having issues? Check these common problems:| Error | Cause | Fix |
|---|---|---|
| `No such file or directory: app.py` | Missing entry point | Create `app.py` in the root directory |
| `ModuleNotFoundError` | Missing dependencies | Add packages to `requirements.txt` |
| `Unauthorized` or `Not Found` | Wrong or missing bot token | Check your token in the `.env` file |
| Bot starts but doesn't respond | Token or polling issue | Check the **Console** tab for error messages |
| `Cannot find module 'telegraf'` | Missing `package.json` | Upload your `package.json` with telegraf as a dependency |
CanerAkar