IronNotify

IronNotify SDK for .NET

Event notifications and alerts for .NET applications

NuGet License: MIT

WebsiteDocumentation.NET GuideGit

--- **IronNotify** helps you send event notifications and alerts to your users instantly. Built for developers who want simple, powerful notification infrastructure without the complexity. ## Installation ```bash dotnet add package IronNotify.Client ``` ## Quick Start ### Simple Usage ```csharp using IronNotify.Client; // Create client with API key var client = new NotifyClient("your-api-key", appSlug: "my-app"); // Send an event var result = await client.NotifyAsync( eventType: "order.completed", title: "New Order Received", severity: Severity.Info, message: "Order #12345 has been placed" ); if (result.Success) { Console.WriteLine($"Event sent! ID: {result.EventId}"); } ``` ### Fluent Builder ```csharp var result = await client .Event("payment.failed") .WithSeverity(Severity.High) .WithTitle("Payment Failed") .WithMessage("Customer payment was declined") .WithEntityId("order-12345") .WithMetadata("amount", 99.99) .WithMetadata("currency", "USD") .WithAction("retry", "Retry Payment", webhookUrl: "https://api.example.com/retry") .SendAsync(); ``` ## Configuration Options ```csharp var client = new NotifyClient(new NotifyClientOptions { // Required ApiKey = "your-api-key", // Optional DefaultAppSlug = "my-app", DefaultSource = "backend-service", BaseUrl = "https://ironnotify.com", Timeout = TimeSpan.FromSeconds(30), // Offline queue (enabled by default) EnableOfflineQueue = true, MaxOfflineQueueSize = 500, OfflineQueueDirectory = null // Uses LocalApplicationData by default }); ``` ## Severity Levels ```csharp Severity.Info // Informational events Severity.Warning // Warnings that may need attention Severity.High // Important events requiring action Severity.Critical // Critical events requiring immediate attention ``` ## Metadata Add custom key-value pairs to events: ```csharp await client.NotifyAsync(new NotifyEventRequest { EventType = "user.signup", Title = "New User Registration", Severity = Severity.Info, Metadata = new Dictionary { ["userId"] = "user-123", ["plan"] = "pro", ["referrer"] = "google" } }); ``` ## Actions Add clickable actions to notifications: ```csharp await client .Event("server.down") .WithSeverity(Severity.Critical) .WithTitle("Server Unreachable") .WithAction("restart", "Restart Server", webhookUrl: "https://api.example.com/restart") .WithAction("acknowledge", "Acknowledge") .SendAsync(); ``` ## Offline Queue Events are automatically queued when the network is unavailable: ```csharp var result = await client.NotifyAsync("event.type", "Title"); if (result.Queued) { Console.WriteLine("Event queued for retry when online"); } // Check queue status if (client.OfflineQueue != null) { Console.WriteLine($"Queued items: {client.OfflineQueue.Count}"); } ``` The offline queue: - Persists events to disk - Automatically retries when connectivity is restored - Respects `MaxOfflineQueueSize` limit - Works across app restarts ## Real-Time Notifications For receiving real-time notifications, use `NotifyRealTimeClient`: ```csharp using IronNotify.Client; var realtime = new NotifyRealTimeClient( hubUrl: "https://ironnotify.com/hubs/events", apiKey: "your-api-key" ); // Subscribe to events realtime.OnEventReceived += (sender, evt) => { Console.WriteLine($"Received: {evt.Title} ({evt.Severity})"); }; // Connect await realtime.ConnectAsync(); // Join app channel await realtime.JoinAppAsync("my-app"); // Disconnect when done await realtime.DisconnectAsync(); ``` ## Dependency Injection ```csharp // Register in DI container services.AddSingleton(sp => new NotifyClient(new NotifyClientOptions { ApiKey = configuration["IronNotify:ApiKey"], DefaultAppSlug = configuration["IronNotify:AppSlug"] })); ``` ## Common Event Types ```csharp // User events "user.signup", "user.login", "user.password_reset" // Order events "order.created", "order.completed", "order.cancelled" // Payment events "payment.succeeded", "payment.failed", "payment.refunded" // System events "server.error", "deployment.completed", "backup.finished" ``` ## Documentation For complete documentation, visit [ironnotify.com/docs](https://ironnotify.com/docs). ## Other SDKs | Platform | Package | |----------|---------| | JavaScript/TypeScript | [@ironservices/notify](https://git.marketally.com/ironservices/ironnotify-js) | | Python | [ironnotify](https://git.marketally.com/ironservices/ironnotify-python) | | Go | [ironnotify-go](https://git.marketally.com/ironservices/ironnotify-go) | | Java | [ironnotify-java](https://git.marketally.com/ironservices/ironnotify-java) | | Rust | [ironnotify](https://git.marketally.com/ironservices/ironnotify-rust) | ## Support - **Documentation**: [ironnotify.com/docs](https://ironnotify.com/docs) - **Email**: dev@ironservices.io - **Issues**: [git.marketally.com/ironservices/ironnotify-dotnet/issues](https://git.marketally.com/ironservices/ironnotify-dotnet/issues) ## License MIT License - see [LICENSE](LICENSE) for details.