A Telegram bot that monitors the Bilkent University IELTS exam dates and sends notifications when dates change.
- 🕐 Automatic Monitoring: Checks the website every 5 minutes
- 📅 Date Change Detection: Monitors both exam date and application deadline
- 📱 Telegram Notifications: Sends formatted messages to registered users
- 💾 State Persistence: Remembers last seen dates to detect changes
- 🔄 Error Handling: Robust error handling with user notifications
- 🛠️ Multiple Scraping Methods: Fallback methods for reliable data extraction
- Message @BotFather on Telegram
- Use
/newbotcommand - Follow the instructions to create your bot
- Save the bot token you receive
- Start a conversation with your bot
- Send
/startcommand - Check the bot logs to see your chat ID
- Add more users by having them start the bot
npm install- Copy
env.exampleto.env:
cp env.example .env- Edit
.envfile with your configuration:
BOT_TOKEN=your_telegram_bot_token_here
CHAT_IDS=123456789,987654321
TARGET_URL=http://prep.bilkent.edu.tr/ielts/
CHECK_INTERVAL=5
LOG_LEVEL=info# Build TypeScript
npm run build
# Run the bot
npm start
# Or run in development mode
npm run dev/start- Initialize the bot and see welcome message/status- Check bot status and configuration/help- Show help information
| Variable | Description | Default |
|---|---|---|
BOT_TOKEN |
Your Telegram bot token | Required |
CHAT_IDS |
Comma-separated list of chat IDs to notify | Required |
TARGET_URL |
URL to monitor | http://prep.bilkent.edu.tr/ielts/ |
CHECK_INTERVAL |
Check interval in minutes | 5 |
LOG_LEVEL |
Logging level (error, warn, info, debug) | info |
Run the bot on your local machine for testing and development.
Deploy on a VPS or dedicated server for 24/7 monitoring.
- Create a Google Cloud project
- Enable Cloud Functions API
- Deploy using the provided deployment script
- Set up Cloud Scheduler to trigger the function every 5 minutes
- Create a Lambda function
- Upload the code
- Set up EventBridge (CloudWatch Events) to trigger every 5 minutes
- Connect your GitHub repository
- Set environment variables
- Deploy automatically
- Create a new Web Service
- Connect your repository
- Set environment variables
- Deploy
polling-bot/
├── src/
│ ├── index.ts # Main application entry point
│ ├── config.ts # Configuration management
│ ├── types.ts # TypeScript type definitions
│ ├── logger.ts # Logging utility
│ ├── webScraper.ts # Web scraping functionality
│ ├── stateManager.ts # State persistence
│ └── telegramBot.ts # Telegram bot management
├── dist/ # Compiled JavaScript (after build)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── env.example # Environment variables template
└── README.md # This file
The bot provides comprehensive logging:
- INFO: General operation information
- WARN: Non-critical issues
- ERROR: Critical errors that need attention
- DEBUG: Detailed debugging information
-
Bot not responding
- Check if BOT_TOKEN is correct
- Verify the bot is started with BotFather
-
No notifications received
- Ensure CHAT_IDS are correct
- Check if users have started the bot with
/start
-
Website scraping fails
- The bot has fallback methods
- Check if the website structure has changed
- Verify internet connectivity
-
State not persisting
- Check file permissions for
bot-state.json - Ensure the bot has write access to the directory
- Check file permissions for
To get chat IDs for notifications:
- Start the bot and send
/start - Check the bot logs for the chat ID
- Add the chat ID to your
.envfile
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details
For issues and questions:
- Check the troubleshooting section
- Review the logs for error messages
- Open an issue on GitHub
- Keep your BOT_TOKEN secret
- Don't commit
.envfile to version control - Use environment variables in production
- Regularly update dependencies