Save files from Telegram directly to your VPS.
Make sure your VPS has the following installed:
Node.js 18+
node -v # should print v18 or higherIf not installed: https://nodejs.org/en/download/package-manager
pm2 (process manager — keeps the bot running after you log out)
npm install -g pm2- Open Telegram and search for @BotFather
- Send it the message:
/newbot - Follow the prompts — give your bot a name and username
- BotFather will reply with a bot token that looks like:
8771463368:AAEco1FGHQvShGKA8P3qn1JvS6j_nlHw_7A - Copy and save this token — you'll need it in Step 3
- Open Telegram and search for @userinfobot
- Send it any message (e.g.
/start) - It replies with your numeric user ID, e.g.
453466480 - Copy and save this number — you'll need it in Step 3
SSH into your VPS, then run:
# Clone the repo
git clone https://github.com/CryptoPilot16/vps-uploader /opt/uploader
cd /opt/uploader
# Install dependencies
npm installNow open the config file:
nano ecosystem.config.jsReplace the placeholder values with your token and user ID:
TELEGRAM_BOT_TOKEN: 'your-token-here',
ALLOWED_USER_ID: 'your-user-id-here',Save and exit (Ctrl+X, then Y, then Enter).
# Start the bot
pm2 start ecosystem.config.js
# Save so pm2 remembers it
pm2 save
# Set pm2 to auto-start on VPS reboot
pm2 startup
# pm2 will print a command — copy and run it (it starts with "sudo env PATH=...")
pm2 save- Open Telegram and find your bot by its username
- Send it a photo or file
- The bot should reply with a file path like:
/opt/uploader/inbox/2026-04-08T12-30-45_photo.jpg
If nothing happens, check the logs:
pm2 logs vps-uploader| Command | Description |
|---|---|
/help |
Show available commands |
/list |
Show the last 10 files in inbox |
/clear |
Delete all files in inbox |
Send any of the following — the bot saves it and replies with the path:
- Photos / images
- Documents (any format, e.g. PDF, ZIP, PNG)
- Videos
- Voice messages / audio files
Telegram's file size limit is 20 MB per file.
If you need to change the token or user ID after first deploy:
nano /opt/uploader/ecosystem.config.js
# make your changes, save
pm2 delete vps-uploader
pm2 start ecosystem.config.js
pm2 savepm2 logs vps-uploader # live log stream
pm2 logs vps-uploader --lines 50 # last 50 lines
pm2 status # check if bot is running- Only your Telegram user ID can interact with the bot — all other users are silently ignored
- Files are saved to
/opt/uploader/inbox/with a timestamp prefix - Run
/clearin Telegram when the inbox gets cluttered
