Skip to main content
Telegram bots need a machine that is always online. Your Opus Host VPS is exactly that. This guide covers deploying a bot in Python or Node.js and keeping it alive after crashes and reboots.

1. Create a bot and get a token

  1. Open Telegram and message @BotFather.
  2. Send /newbot and follow the prompts.
  3. Save the token BotFather gives you. You will need it below.

2. Install your language

3. Get your bot code onto the VPS

Clone from Git or upload via the File Manager:

4. A minimal example bot

Create bot.py:
Test it:
Message your bot on Telegram and send /start. If it responds, you are ready to run it as a service.

5. Keep it running with systemd

Create /etc/systemd/system/mybot.service:
For Node.js, use ExecStart=/usr/bin/node /root/mybot/index.js. Enable and start:
See systemd Services for the full reference.
Store the token in a .env file loaded by python-dotenv or the dotenv npm package instead of pasting it into the service file. Easier to rotate, easier to keep out of Git.
Never commit your bot token to a public repository. If it leaks, revoke it immediately from BotFather with /revoke and generate a new one.