Telegram Bots

Installation

CanerAkar Mar 17, 2026

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:
  1. An FPS.ms accountcreate your first server and select a Telegram bot package (Python or Node.js)
  2. A Telegram bot token — follow our creating your bot with BotFather guide if you don't have one yet
  3. 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 executing app.py as the entry point by default. Follow these steps to get your bot online.

1. Create your main file

Create a file named app.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 directory
Here is an example bot using the python-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 a requirements.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
You can also install additional packages via the Startup tab under Additional Python packages without editing 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
See our environment variables guide for more details on managing secrets securely.

4. Upload and start

  1. Upload app.py, requirements.txt, and .env to your server via the Files tab in the panel or through SFTP
  2. Click Start on the Console tab
Your bot should come online within a few seconds. You will see 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 in package.json. You have three ways to get your code onto the server.

Upload methods

MethodBest forHow it works
**GitHub repository**Active developmentEnter your repo details in the **Startup** tab, then press **Reinstall Server**
**SFTP upload**Large projectsUpload your project folder via [SFTP](/getting-started/connecting-to-sftp/)
**Panel file manager**Quick editsCreate 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.
#### Using a GitHub repository To deploy from GitHub:
  1. Go to the Startup tab on the panel
  2. Enter your Git Repo Address (e.g., https://github.com/yourname/your-bot)
  3. Optionally set the Branch, Git Username, and Git Access Token (required for private repos)
  4. If you have existing files on the server, select all files and delete them first
  5. Click Reinstall Server to pull the code from GitHub
  6. 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

  1. Create a .env file with your bot token: BOT_TOKEN=your-token-here
  2. Upload your project files using one of the methods above
  3. Click Start on the Console tab
FPS.ms automatically runs npm install to install your dependencies, then starts your bot. You should see Bot is running... in the console.

Python vs Node.js comparison

FeaturePython (python-telegram-bot)Node.js (Telegraf)
Entry point`app.py` (configurable in Startup)`index.js` (configurable in Startup)
Dependencies`requirements.txt``package.json`
LanguagePythonJavaScript
Best forBeginners, data processing botsJS developers, webhook-based bots
Community sizeVery largeLarge
Async supportBuilt-in (asyncio)Built-in (Promises)

Polling vs webhooks

Telegram bots can receive updates in two ways:
MethodHow it worksBest for
**Polling**Your bot asks Telegram for new messages periodicallyFPS.ms free hosting (recommended)
**Webhooks**Telegram sends messages to your bot's URLPaid 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:

Troubleshooting

Having issues? Check these common problems:
ErrorCauseFix
`No such file or directory: app.py`Missing entry pointCreate `app.py` in the root directory
`ModuleNotFoundError`Missing dependenciesAdd packages to `requirements.txt`
`Unauthorized` or `Not Found`Wrong or missing bot tokenCheck your token in the `.env` file
Bot starts but doesn't respondToken or polling issueCheck the **Console** tab for error messages
`Cannot find module 'telegraf'`Missing `package.json`Upload your `package.json` with telegraf as a dependency
For more help, see our full troubleshooting guide.

Was this article helpful?