WebHookReceiver
WebHook Receiver je komplexní řešení pro shromažďování, zpracování a zobrazování oznámení z různých zdrojů webhooků v systémech Windows, Android, iOS a macOS
GitHub Stats
Technologies
C# HTMLDetailed Description
๐ WebHook Receiver
๐ Overview
WebHook Receiver is a comprehensive solution for collecting, processing, and displaying notifications from various webhook sources on Windows, Android, iOS, and macOS systems. It provides a secure API endpoint for receiving webhooks from any service, and user-friendly applications that display real-time notifications to users across multiple platforms.
Perfect for:
- Monitoring CI/CD pipelines
- Tracking application events and alerts
- Receiving notifications from IoT devices
- Integrating with third-party services that support webhooks (GitHub, Slack, etc.)
- Creating custom notification systems for your applications
This project consists of these applications that communicate in real-time:
- ๐ WebHookReceiverApi - ASP.NET Core Web API application that receives webhooks and forwards them to clients using SignalR
- ๐ป WebHookNotifier - Windows desktop application (WPF) that displays notifications based on received webhooks
- ๐ฑ WebHookNotifierMaui - Cross-platform application (.NET MAUI) for Windows, Android, iOS, and macOS
- ๐ ApiKeyGenerator - Tool for generating API keys for API security
โจ Features
- ๐ Real-time notifications for webhooks
- ๐ Secure API with API key authentication
- ๐ป System tray integration with custom icon
- ๐ Notification history with search and filtering
- ๐ Export history to CSV and JSON formats
- ๐๏ธ Support for SQLite and SQL Server databases
- ๐ Secure connection string storage with encryption
- ๐ฏ Comprehensive test coverage
- ๐ Detailed documentation
๐ Detailed Documentation
For more detailed information, please refer to the following documentation:
- Usage Guide - Comprehensive guide with examples and detailed instructions for all applications
- WebHookNotifierMaui Documentation - Detailed guide for the MAUI cross-platform application
- Configuration Guide - Complete configuration options for all components
- Development Guide - Information for developers who want to extend or modify the system
๐ป Technologies
- ๐ฅ .NET 9
- ๐ ASP.NET Core Web API
- ๐ฌ SignalR for real-time communication
- ๐ป WPF for Windows application
- ๐ Hardcodet.NotifyIcon.Wpf for system tray integration
- ๐ฑ Jetpack Compose for Android UI
- ๐ฌ Microsoft SignalR Java client for Android
- ๐๏ธ Entity Framework Core and Room for database access
- ๐ SQLite and SQL Server database support
๐ Project Structure
๐ WebHookReceiverApi/ - API project
- Controllers/ - API controllers
- Hubs/ - SignalR hubs
- Middleware/ - API key authentication middleware
- Models/ - Data models
- wwwroot/ - Static files (including test HTML page)
๐ป WebHookNotifier/ - Windows application
- Models/ - Data models
- Services/ - Communication and notification services
- Data/ - Database context and repositories
- Security/ - Encryption and security services
- Resources/ - Icons and other resources
๐ฑ WebHookNotifierMaui/ - Cross-platform application (.NET MAUI)
- Models/ - Data models
- Services/ - Communication and notification services
- Data/ - Database context and repositories
- Views/ - User interface pages
- Platforms/ - Platform-specific implementations
- Resources/ - Icons, images, and other resources
๐ ApiKeyGenerator/ - API key generator tool
- Generates secure API keys
- Updates API configuration file
- Saves generated key to a file
๐ Installation and Running
๐ Requirements
- .NET 9 SDK
- Windows (for Windows client application)
- Android 7.0+ (API level 24+), iOS 15.0+, or macOS 11.0+ for MAUI application
๐ Running the API
cd WebHookReceiverApi
dotnet run
The API will be available at http://localhost:5017.
๐ป Running the Windows Application
cd WebHookNotifier
dotnet run
๐ฑ Running the MAUI Application
For Windows:
cd WebHookNotifierMaui
dotnet build -t:Run -f net9.0-windows10.0.19041.0
For Android:
cd WebHookNotifierMaui
dotnet build -t:Run -f net9.0-android
For iOS:
cd WebHookNotifierMaui
dotnet build -t:Run -f net9.0-ios
For macOS:
cd WebHookNotifierMaui
dotnet build -t:Run -f net9.0-maccatalyst
๐ Usage
๐ Security
API Key Security
The API is secured using API keys. To generate a new API key, use the ApiKeyGenerator tool:
cd ApiKeyGenerator
dotnet run
This tool generates a new API key and updates the API configuration file. The generated key is also saved to the apikey.txt file.
When calling the API, you need to add the X-API-Key header with a valid API key value.
SignalR Key Security
In addition to the API key, a SignalR key is required for clients to connect to the SignalR hub. This key is configured in the API's appsettings.json file in the AppSettings.SignalRKey section.
When connecting to the SignalR hub, clients need to provide this key as a query parameter:
http://localhost:5017/notificationHub?signalRKey=your-signalr-key-here
This ensures that only authorized clients can connect to the notification hub.
Example cURL Request
curl -X POST "http://localhost:5017/api/webhook" \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{
"event": "deployment",
"message": "Application successfully deployed",
"timestamp": "2025-04-14T12:00:00Z",
"source": "CI/CD Pipeline",
"severity": "info",
"data": {
"version": "1.0.0",
"environment": "production",
"duration": 120
}
}'
For more examples and detailed information about the API structure, see the Usage Guide.
๐ฌ Testing Webhooks
- Start the API project
- Open
http://localhost:5017/test.htmlin your browser - Fill out the form including the API key and submit the webhook
- Start the Windows application and connect to the API
- After sending webhooks, notifications will appear in the system tray
๐ Notification History
The application includes a comprehensive notification history system that allows you to:
- View all received notifications in a searchable, filterable list
- See detailed information about each notification
- Export history to CSV or JSON formats
- Configure database storage options
Using the History Feature
- Click the "View History" button in the main window or select "View History" from the system tray menu
- Use the search box to find specific notifications by content
- Filter by date range using the date pickers
- Filter by event type using the dropdown
- Click on any notification to view its details
- Use the export buttons to save history to CSV or JSON format
Database Configuration
The history system supports two database types:
- SQLite (default): Local file-based database, perfect for individual users
- SQL Server: Enterprise-grade database for multi-user or centralized deployments
To configure the database:
- Open Settings from the main window or system tray menu
- Navigate to the History section
- Enable or disable history tracking
- Set the number of days to retain history
- Select your preferred database type
- For SQL Server, enter and test your connection string
โ๏ธ Configuration
API
- Ports and other settings can be modified in the
WebHookReceiverApi/Properties/launchSettings.jsonfile - The API key is stored in the
WebHookReceiverApi/appsettings.jsonfile in theAppSettings.ApiKeysection
Windows Application
- The API URL can be set in the application
- Notification settings are stored in
%AppData%\WebHookNotifier\settings.json - SQLite database is stored in
%AppData%\WebHookNotifier\notifications.db - SQL Server connection strings are encrypted using Windows Data Protection API
MAUI Application
- The API URL can be set in the application
- Notification settings are stored in the application's local storage
- SQLite database is stored in the application's local storage
- SQL Server connection strings are encrypted using platform-specific encryption
- On Android, direct WebSockets can be used instead of SignalR for better performance
๐ ๏ธ Development
โ Adding New Webhook Types
- Modify the
WebhookDatamodel as needed - Implement processing of new types in
WebhookController
๐ Customizing Notifications
The application offers several ways to customize notifications:
Notification Display
- Notification display customizations can be made in the
NotificationServiceclass - Format and styling of notifications can be modified in the
FormatNotificationMessagemethod inMainWindow.xaml.cs
Rate Limiting
To prevent notification overload, you can configure rate limiting in the Settings window:
- Set minimum seconds between notifications
- Set maximum number of queued notifications
- Enable or disable notification sounds
Security
- Enable or disable encryption for data transmission between API and client
๐จ Testing
The project includes unit tests for the API. To run the tests:
cd WebHookReceiverApiTests
dotnet test
๐ฎ License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
๐จโ๐ป Author
This project was developed by Michal Grznรกr (michal@grznar.eu).
Project URL: https://github.com/Michal1609/WebHookReceiver