docs
Telegram Monitoring

Telegram Monitoring

GSwarm includes a powerful Telegram monitoring service that provides real-time notifications about your blockchain activity, including votes, rewards, and balance changes.

Features

  • 🔔 Real-time Notifications: Get instant updates on blockchain activity
  • 📊 Vote Tracking: Monitor your voting activity and changes
  • 💰 Reward Monitoring: Track reward accumulation and changes
  • 💎 Balance Updates: Monitor your wallet balance changes
  • 📈 Change Detection: Only notified when values actually change
  • 🛡️ Secure Configuration: Local config file storage

Prerequisites

Before setting up Telegram monitoring, you'll need:

  1. EOA Address: Get your Ethereum address from your Gensyn dashboard (opens in a new tab)
  2. Telegram Account: A Telegram account to receive notifications

Setup Instructions

1. Get Your EOA Address

  1. Log into your Gensyn dashboard (opens in a new tab)
  2. Navigate to your account settings or profile section
  3. Copy your Ethereum address (EOA) - this is required for monitoring your blockchain activity

2. Create a Telegram Bot

  1. Start a chat with @BotFather (opens in a new tab) on Telegram
  2. Send /newbot and follow the instructions
  3. Choose a name for your bot (e.g., "GSwarm Monitor")
  4. Choose a username (must end with 'bot', e.g., "gswarm_monitor_bot")
  5. Save the bot token provided by BotFather

3. Get Your Chat ID

  1. Start a chat with your bot by clicking the link or searching for it
  2. Send any message to the bot (e.g., "Hello")
  3. Visit this URL in your browser (replace YOUR_BOT_TOKEN with your actual token):
    https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates
  4. Find your chat ID in the response (look for "chat":{"id":123456789})

4. Run the Telegram Service

# Basic usage (will prompt for bot token, chat ID, and EOA address)
gswarm --telegram
 
# With custom config path
gswarm --telegram --telegram-config-path /path/to/telegram-config.json
 
# Force update configuration
gswarm --telegram --update-telegram-config

Telegram Command Options

FlagDescriptionDefaultEnvironment Variable
--telegramStart Telegram monitoring servicefalseGSWARM_TELEGRAM
--telegram-config-pathPath to telegram-config.jsontelegram-config.jsonGSWARM_TELEGRAM_CONFIG_PATH
--update-telegram-configForce update of Telegram configfalseGSWARM_UPDATE_TELEGRAM_CONFIG

Configuration Files

The Telegram service creates and manages these files:

  • telegram-config.json: Stores your bot token, chat ID, and EOA address
  • telegram_previous_data.json: Tracks previous blockchain data for change detection

Example Usage

# First time setup (interactive)
gswarm --telegram
 
# Run with existing config
gswarm --telegram
 
# Update configuration
gswarm --telegram --update-telegram-config
 
# Custom config path
gswarm --telegram --telegram-config-path /path/to/telegram-config.json

What You'll Receive

The Telegram service monitors and notifies you about:

  • Vote Changes: When your vote count increases or decreases
  • Reward Changes: When your accumulated rewards change
  • Balance Changes: When your wallet balance changes
  • Welcome Message: Initial setup confirmation

Sample Notifications

Vote Update

🎯 Vote Update
Previous: 1,234 votes
Current: 1,456 votes
Change: +222 votes (+18.0%)

Reward Update

💰 Reward Update  
Previous: 0.5 ETH
Current: 0.75 ETH
Change: +0.25 ETH (+50.0%)

Balance Update

💎 Balance Update
Previous: 2.1 ETH
Current: 2.3 ETH
Change: +0.2 ETH (+9.5%)

Troubleshooting Telegram

"Bot token invalid"

  • Verify your bot token from @BotFather
  • Use --update-telegram-config to re-enter it

"Chat ID not found"

  • Make sure you've sent a message to your bot
  • Check the getUpdates URL response
  • Use --update-telegram-config to re-enter it

"EOA address not found"

"No notifications received"

  • Check that your bot is active
  • Verify the chat ID is correct
  • Ensure you have blockchain activity to monitor
  • Confirm your EOA address is correct

How Telegram Monitoring Works

The Telegram monitoring service:

  1. Monitors blockchain data via Alchemy API using your EOA address
  2. Tracks changes in votes, rewards, and balance
  3. Sends formatted notifications via Telegram Bot API
  4. Implements change detection to avoid spam notifications
  5. Stores configuration securely in local files

Security Considerations

  • Bot tokens and EOA addresses are stored locally in telegram-config.json
  • No sensitive data is transmitted beyond your bot token, chat ID, and EOA address
  • Configuration files should be kept secure and not shared publicly
  • The service only reads blockchain data and doesn't modify any settings

Integration with Main Supervisor

You can run Telegram monitoring alongside the main supervisor:

# Run both supervisor and Telegram monitoring
gswarm --telegram --org-id YOUR_ORG_ID --hf-token YOUR_TOKEN
 
# Run only Telegram monitoring (if supervisor is already running)
gswarm --telegram

Advanced Configuration

Custom Notification Intervals

The service checks for updates every 30 seconds by default. You can modify this by editing the source code if needed.

Multiple Chat Support

Currently, the service supports one chat ID per configuration. For multiple recipients, you can:

  1. Add multiple users to a Telegram group
  2. Use the group chat ID instead of individual chat IDs
  3. Create multiple bot instances if needed

Notification Filtering

The service only sends notifications when values actually change. This prevents spam and ensures you only get meaningful updates.

Next Steps

Now that you have Telegram monitoring set up:

  1. Test the notifications by running the service
  2. Monitor your blockchain activity in real-time
  3. Configure additional notification preferences if needed
  4. Explore Advanced Usage for more complex setups