Telegram Setup
To control your bot and receive real-time notifications, you need to set up a private Telegram bot. This guarantees that only you have access to your trading data and controls.
1. Create a Bot via BotFather
BotFather is the official Telegram bot for managing other bots. Open Telegram, start a chat with BotFather, and follow the steps to create your new trading assistant.
Open @BotFather ↗2. Add Bot Token to Config
Once BotFather gives you the HTTP API token, you need to add it to your bot's configuration. This token acts as a secure password for your bot.
File path:
byninja-trading-bot/src/telegram/config/config_telegram.pyReplace the following field with your token:
TELEGRAM_BOT_TOKEN = "...your_telegram_bot_token..."3. Secure Your Bot (Find Chat ID)
For absolute security, your bot must only respond to YOU. We achieve this by linking it to your personal Telegram Chat ID. No one else will be able to execute commands.
First, navigate to the source directory:
cd byninja-trading-bot/srcNext, activate your Python virtual environment. If you haven't set this up yet, please check the Quick Start guide.
source ../env/bin/activateFinally, run the Telegram setup script:
python3 -c "from telegram.setup import main; main()"The setup script is now waiting for you to message the bot from your personal Telegram account.
⚠️ Telegram Bot Setup - Find Your Chat ID
🔍 Checking Telegram API connection...
TelegramBot - INFO - Telegram connected | Bot: @Bot
🎯 Finding Chat ID...
============================================================
🔍 Waiting for message from you...
IMPORTANT: First find the bot in Telegram and send it ANY message
1. Open Telegram
2. Find @Bot
3. Press START or send any message
4. Wait 10 seconds...
⏹️ To stop press Ctrl+C
🔍 Checking updates... status: 200
📭 No messages found. Send bot a message in Telegram...
🔍 Checking updates... status: 200
📭 No messages found. Send bot a message in Telegram...
🔍 Checking updates... status: 200Once you send a message, the bot will instantly recognize you and output your secure Chat ID.
✅ Found new message!
👤 From: User
📩 Text: 'hi'
🆔 Your Chat ID: 449933911
💡 Add to config.py: TELEGRAM_CHAT_ID = '449933911'
✅ Chat ID obtained successfully!
🆔 Your Chat ID: 449933911
💾 Add this to config_telegram.py:
TELEGRAM_CHAT_ID = "449933911"
🧪 Testing message sending capability...
🎉 Test message sent! Check Telegram.Copy your unique Chat ID and add it to the same configuration file:
TELEGRAM_CHAT_ID = "...your_private_telegram_chat_id..."Pro Tip: Use a Code Editor
For a much better experience editing configuration files, we recommend using a professional code editor like Visual Studio Code.
Download VS Code ↗