A Rust-based Telegram bot that automatically posts cryptocurrency price updates to a Telegram channel every hour using GitHub Actions. Currently tracks Bitcoin and Solana, with easy extensibility for additional cryptocurrencies.
- 🔄 Automated hourly updates via GitHub Actions
- 💰 Multi-coin support - Bitcoin, Solana, and easily extensible to other coins
- 📊 Real-time prices from CoinPaprika API
- 📱 Clean formatted messages with emoji and HTML formatting
- 🚀 Simple deployment - no server required
- 🔒 Secure - credentials stored in GitHub Secrets
- ⚡ Fast and efficient - runs once per execution, exits cleanly
- GitHub Actions triggers the bot every hour via cron schedule
- Bot fetches current prices for all configured cryptocurrencies from CoinPaprika API
- Formats a nice message with prices for each coin
- Sends the message to your configured Telegram channel
- Exits (no continuous running process needed)
- Open Telegram and search for @BotFather
- Send
/newbotcommand - Follow the prompts to choose a name and username
- Copy the bot token (you'll need this later)
- Create a new channel in Telegram
- Add your bot as an administrator to the channel
- Get your channel ID:
- For public channels: use
@channelnameformat - For private channels: use a bot like @getidsbot to get the numeric ID (e.g.,
-1001234567890)
- For public channels: use
git clone <your-repo-url>
cd cryptobot- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Add the following secrets:
TELOXIDE_TOKEN: Your bot token from BotFatherTELEGRAM_CHANNEL_ID: Your channel ID (e.g.,@mychannelor-1001234567890)
- Go to the Actions tab in your repository
- Enable workflows if prompted
- The bot will now run automatically every hour
- Create a
.envfile in the project root:
TELOXIDE_TOKEN=your_bot_token_here
TELEGRAM_CHANNEL_ID=@your_channel_here- Build and run:
cargo build --release
cargo run --release- Check your Telegram channel for the message
cryptobot/
├── Cargo.toml # Project dependencies
├── .env # Local environment variables (gitignored)
├── .gitignore # Git ignore rules
├── src/
│ └── main.rs # Main bot logic (coin configuration on line 105)
├── .github/
│ └── workflows/
│ └── hourly-update.yml # GitHub Actions workflow
└── README.md # This file
- TELOXIDE_TOKEN (required): Your Telegram bot token
- TELEGRAM_CHANNEL_ID (required): Target channel ID
Edit .github/workflows/hourly-update.yml:
on:
schedule:
# Current: Every hour at minute 0
- cron: '0 * * * *'
# Examples:
# Every 30 minutes: '*/30 * * * *'
# Every 6 hours: '0 */6 * * *'
# Daily at noon: '0 12 * * *'-
Check GitHub Actions logs:
- Go to Actions tab → Select latest workflow run
- Review the logs for error messages
-
Verify bot permissions:
- Ensure bot is an administrator in the channel
- Check that bot can post messages
-
Validate credentials:
- Double-check
TELOXIDE_TOKENin GitHub Secrets - Verify
TELEGRAM_CHANNEL_IDformat
- Double-check
-
Test locally:
- Run the bot locally with
.envfile to isolate issues
- Run the bot locally with
- "TELOXIDE_TOKEN not set": Add the token to GitHub Secrets
- "Failed to send message": Check bot permissions in channel
- "Invalid channel ID": Use correct format (
@usernameor numeric ID) - API rate limiting: CoinPaprika free tier has rate limits; don't run too frequently
- teloxide (0.14): Telegram bot framework
- reqwest (0.11): HTTP client for API calls
- tokio (1.x): Async runtime
- serde/serde_json: JSON serialization
- anyhow: Error handling
- dotenv: Environment variable loading
- rusty-money (0.5): Currency formatting
- Endpoint:
https://api.coinpaprika.com/v1/tickers/{coin-id} - Rate Limit: 10-30 calls/minute (free tier)
- No authentication required
- Documentation: https://coinpaprika.com/api
- Bitcoin (BTC) - ID:
btc-bitcoin - Solana (SOL) - ID:
sol-solana
To add support for additional cryptocurrencies:
- Find the coin ID from CoinPaprika (format:
{symbol}-{name}) - Open
src/main.rs - Add the coin ID to the
coinsarray on line 105:
let coins = ["btc-bitcoin", "sol-solana", "eth-ethereum"]; // Add your coin here- Commit and push your changes - the bot will automatically track the new coin!
Potential improvements:
- Support multiple cryptocurrencies ✅
- Price change percentage (24h)
- Price alerts for thresholds
- Historical price charts
- Price trend indicators
- Store price history
MIT License - Feel free to use and modify!
Contributions are welcome! Please open an issue or submit a pull request.
This bot is for informational purposes only. Cryptocurrency prices are volatile. Do not make financial decisions based solely on this bot's data.