Setting Up Telegram Bot
Complete guide to setting up the Telegram bot integration.
Step 1: Create a Bot
- Open Telegram and search for @BotFather
- Start a chat and send
/newbot - Follow the prompts:
- Enter a name for your bot (e.g., “My Terminal Bot”)
- Enter a username (must end in
bot, e.g.,my_terminal_bot)
- BotFather will give you a token like:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz - Save this token — you’ll need it next
Step 2: Get Your User ID
- Open Telegram and search for @userinfobot
- Start a chat (or send any message)
- The bot will reply with your user ID:
Your user ID: 987654321 - Save this ID
Step 3: Configure remote-terminal
Add to your .env file:
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
TELEGRAM_ALLOWED_USERS=987654321
Step 4: Start the Server
npm start
You should see:
[telegram] Bot started (@your_bot_username)
Step 5: Test the Bot
- Open Telegram
- Search for your bot by username
- Send
/start - You should see the help message
Adding Multiple Users
Separate user IDs with commas:
TELEGRAM_ALLOWED_USERS=987654321,123456789,555555555
Customizing Commands
Edit config/default.json to add your own commands:
{
"telegram": {
"commands": {
"deploy": {
"cmd": "npm run deploy",
"description": "Deploy to production"
}
}
}
}
Security Tips
- Never share your bot token — Anyone with it can control your bot
- Only add trusted users — They get full shell access
- Use a dedicated bot — Don’t reuse tokens from other projects