Docs Download
Home / Docs / Broadcast & Notification Channels / How do I create a Telegram bot?

How do I create a Telegram bot?

Creating a Telegram bot is straightforward and allows MagicTradeBot to send real-time notifications for trades, risk events, and system alerts. Below is a step-by-step guide.


πŸ”Ή 1️⃣ Create a Bot via @BotFather

  1. Open Telegram and search for @BotFather.
  2. Start a chat with BotFather and send the command:

    /newbot
    
  3. Follow the prompts:

    • Choose a name for your bot (visible to users).
    • Choose a username (must end with bot, e.g., MagicTradeAlertBot).
  4. Once created, BotFather provides a Bot Token.

    • Example: 123456789:ABCDefGhIJKlmNoPQRsTUVwxyz1234567890
    • Save this token securely, as it is used by MagicTradeBot to send messages.

πŸ”Ή 2️⃣ Obtain Your Chat ID

The chat ID tells MagicTradeBot where to send messages. You can send messages to:

  • Your personal Telegram account
  • A group chat
  • A channel

Method A: Personal Chat ID

  1. Start a chat with your bot.
  2. Send a message like Hello to the bot.
  3. Open your web browser and go to:

    https://api.telegram.org/bot<YourBotToken>/getUpdates
    

    Replace <YourBotToken> with the token from BotFather.

  4. Look for the "chat":{"id":...} field in the JSON response β€” this is your chat ID.

Method B: Group or Channel ID

  1. Add your bot to the group or channel.
  2. Send a test message in that group/channel.
  3. Repeat the getUpdates method above to retrieve the chat ID.

Note: For channels, make sure your bot is an admin to send messages.


πŸ”Ή 3️⃣ Configure MagicTradeBot

Open your settings/market_watch.yaml or relevant notification config file and add:

telegram_bot_token: "123456789:ABCDefGhIJKlmNoPQRsTUVwxyz1234567890"
telegram_chat_id: "987654321"  # Replace with your actual chat ID
  • telegram_bot_token β†’ The token you received from BotFather
  • telegram_chat_id β†’ Your personal, group, or channel chat ID

Save the file and restart the bot (recommended) to activate Telegram notifications.


πŸ”Ή 4️⃣ Test Your Bot

  • Send a test alert from MagicTradeBot or manually trigger a message.
  • Ensure the bot delivers messages to your chat or group.
  • Check that stop-loss, take-profit, DCA, and trade execution alerts are working correctly.

πŸ”Ή 5️⃣ Best Practices

  • Keep your Bot Token private.
  • Use separate bots for personal vs. team notifications.
  • Only configure active channels to avoid unnecessary errors.
  • Test notifications in demo mode before enabling live trading.

πŸ”Ή Key Takeaway

Creating a Telegram bot allows MagicTradeBot to send fast, reliable, and mobile-friendly trade alerts.

  • Step 1: Use @BotFather to create a bot and get the token
  • Step 2: Find your chat ID (personal, group, or channel)
  • Step 3: Configure telegram_bot_token and telegram_chat_id in MagicTradeBot
  • Step 4: Test notifications to confirm delivery

Telegram notifications are recommended for beginners and personal monitoring due to their speed, simplicity, and real-time mobile accessibility.

Ready to trade? Download MagicTradeBot free and test in paper mode before going live.