A Telegram bot that monitors iOS App Store releases and sends notifications to subscribers when new versions are available. Built with modern Swift using the Vapor framework for robust server-side development.
The Release Informer Bot provides a comprehensive subscription system for iOS app release notifications:
- App Discovery: Users can search for apps using the
/search <app name>
command, which queries the iTunes Search API - Subscription Management: Users subscribe to specific apps using
/add <bundle_id>
and manage their subscriptions with/list
and/del <bundle_id>
- Release Monitoring: A background watcher checks all subscriptions every 5 minutes using the iTunes API to detect new versions
- Smart Notifications: When a new version is detected, the bot sends formatted notifications to all subscribed users with release details including version number, release notes, and App Store link
- Data Persistence: All subscriptions are stored in CouchDB with efficient indexing for fast lookups by bundle ID and chat ID
/start
- Show welcome message with inline keyboard/help
- Display help information/search <app name>
- Search for apps in the App Store/add <bundle_id>
- Subscribe to notifications for an app/del <bundle_id>
- Unsubscribe from an app/list
- Show your current subscriptions
- Modern Swift Concurrency: Built with async/await and actors for safe concurrent operations
- Modular Architecture: Clean separation with three modules:
ReleaseInformerBot
: Main bot logic and Telegram handlersReleaseWatcher
: Background monitoring serviceShared
: Common models and database management
- Robust Monitoring: Automated release checking with intelligent rate limiting and error handling
- Scalable Storage: CouchDB integration with optimized views for efficient queries
- Production Ready: Comprehensive logging and error handling
- Real-time Notifications: Instant notifications with rich formatting including release notes
- Resource Management: Intelligent memory management with version history limits (5 versions per app)
- Server Framework: Vapor 4.x for high-performance HTTP server
- Concurrency: Swift's native actor system for thread-safe operations
- Database: CouchDB with custom views for efficient data access
- External APIs: iTunes Search/Lookup API for app metadata
- Deployment: Flexible for local development and production
The project uses carefully selected, production-grade dependencies:
- Vapor
4.110.1+
- Server-side Swift web framework - Swift NIO
2.65.0+
- Non-blocking networking foundation - SwiftTelegramSdk
3.8.0+
- Telegram Bot API client - CouchDB Swift
2.1.0+
- CouchDB client library
- VaporTesting - Testing utilities for Vapor applications
- Swift 6.0+
- CouchDB instance (local or remote)
- Telegram Bot Token (from @BotFather)
-
Clone the repository:
git clone https://github.com/makoni/ReleaseInformerBot.git cd ReleaseInformerBot
-
Set environment variables:
export apiKey="YOUR_TELEGRAM_BOT_TOKEN"
-
Build and run:
swift build swift run
-
Run tests:
swift test
For production deployments, ensure:
- Set
LOG_LEVEL=info
orLOG_LEVEL=warning
- Configure CouchDB credentials in
DBManager.swift
- Use proper secrets management for the Telegram bot token
- Set up monitoring and health checks on port 8080
The bot will automatically create the required CouchDB database (release_bot
) and design document with the necessary views on startup.
Automatic Setup:
- The
DBManager
includes asetupIfNeed()
method that checks for the existence of the database and required views, and creates them if they do not exist. No manual setup is required for most users—just ensure your CouchDB instance is running and credentials are configured inDBManager.swift
.
Manual Setup (optional):
If you prefer to create the database and design document manually, use the following JSON for the design document:
{
"_id": "_design/list",
"language": "javascript",
"views": {
"by_bundle": {
"map": "function(doc) {\n emit(doc.bundle_id, doc);\n}"
},
"by_chat": {
"map": "function(doc) {\n for (var i=0; i<doc.chats.length; i++) {\n emit(doc.chats[i], doc);\n }\n}"
}
}
}
Create a database named release_bot
and add this design document for optimal performance.