Catspeak.Shared.Notification 2.7.1

dotnet add package Catspeak.Shared.Notification --version 2.7.1
                    
NuGet\Install-Package Catspeak.Shared.Notification -Version 2.7.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Catspeak.Shared.Notification" Version="2.7.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Catspeak.Shared.Notification" Version="2.7.1" />
                    
Directory.Packages.props
<PackageReference Include="Catspeak.Shared.Notification" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Catspeak.Shared.Notification --version 2.7.1
                    
#r "nuget: Catspeak.Shared.Notification, 2.7.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Catspeak.Shared.Notification@2.7.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Catspeak.Shared.Notification&version=2.7.1
                    
Install as a Cake Addin
#tool nuget:?package=Catspeak.Shared.Notification&version=2.7.1
                    
Install as a Cake Tool

Catspeak.Shared.Notification

Shared notification services for Catspeak applications. Supports Firestore in-app notifications, SMTP email (via MailKit), and background processing via System.Threading.Channels.

Features

  • INotificationService - High-level notification API
  • INotificationOrchestrator - Queue-based background processing
  • IFirestoreNotificationService - Firestore in-app notifications
  • IEmailSender - SMTP email sending via MailKit
  • OtpEmailTemplate - Static helper for OTP email templates
  • Background processing - System.Threading.Channels for async notification dispatch

Installation

dotnet add package Catspeak.Shared.Notification

Configuration

// Program.cs or Startup.cs
builder.Services.AddCatspeakNotification(options =>
{
    options.Provider = NotificationProvider.Firestore;

    options.Firestore.ProjectId = "your-firestore-project-id";

    options.Smtp.Host = "smtp.gmail.com";
    options.Smtp.Port = 587;
    options.Smtp.Username = "your-smtp-user";
    options.Smtp.Password = "your-smtp-password";
    options.Smtp.FromEmail = "noreply@catspeak.com.vn";
    options.Smtp.FromName = "Cat Speak";
    options.Smtp.ReplyToEmail = "support@catspeak.com.vn";
    options.Smtp.ReplyToName = "Cat Speak Support";

    // Fallback transport (personal Gmail). Used only when the primary
    // provider fails and the message allows fallback (never broadcast).
    options.Smtp.FallbackHost = "smtp.gmail.com";
    options.Smtp.FallbackPort = 587;
    options.Smtp.FallbackUsername = "catspeak.vn@gmail.com";
    options.Smtp.FallbackPassword = "<gmail-app-password>";
    options.Smtp.FallbackFromEmail = "catspeak.vn@gmail.com";

    // Internal recipients (read by admin-notification flows).
    options.AdminEmails.Support = "support@catspeak.com.vn";
    options.AdminEmails.Tech = "tech@catspeak.com.vn";
});

Configuration Keys (flat structure)

Key Description
Firestore:ProjectId Google Firestore project ID
Smtp:Host SMTP server host
Smtp:Port SMTP server port (default: 587)
Smtp:Username SMTP auth username
Smtp:Password SMTP auth password
Smtp:FromEmail Sender email address
Smtp:FromName Sender display name (default: "Cat Speak")
Smtp:ReplyToEmail Reply-To email address
Smtp:ReplyToName Reply-To display name
Smtp:FallbackHost Fallback SMTP host (personal Gmail). Empty = no fallback
Smtp:FallbackPort Fallback SMTP port (default: 587)
Smtp:FallbackUsername Fallback SMTP username (defaults to Smtp:Username)
Smtp:FallbackPassword Fallback SMTP password (defaults to Smtp:Password)
Smtp:FallbackFromEmail Fallback sender address. Empty = no fallback
Smtp:FallbackFromName Fallback sender name (default: "Cat Speak")
AdminEmails:Support Internal support inbox (contact/instructor-apply notices)
AdminEmails:Tech Internal tech inbox (bug-report notices)

Monitoring

Email failover and broadcast retries emit structured logs with stable event IDs. Alert when FallbackUsed spikes (primary provider throttling) or BroadcastDropped appears:

EventId Name Meaning
6101 PrimarySendRetrying Primary send failed transiently, backing off before retry
6102 FallbackUsed Retries exhausted, message rerouted to Gmail fallback (X-Fallback: gmail)
6103 BroadcastRequeued Broadcast has no fallback, requeued once (emailRetryCount)
6104 BroadcastDropped Broadcast failed after the single requeue, message dropped

Suggested alert: more than 10 FallbackUsed (6102) in 5 minutes → primary quota/auth issue, check Resend dashboard.

Usage

Send In-App Notification

var notificationService = serviceProvider.GetRequiredService<INotificationService>();

await notificationService.SendNotificationAsync(new NotificationRequest
{
    UserId = 123,
    Title = "Welcome!",
    Body = "Your account has been created.",
    Type = "welcome",
    Channel = NotificationChannels.InApp
});

Send Email Notification

await notificationService.SendNotificationAsync(new NotificationRequest
{
    UserId = 123,
    Channel = NotificationChannels.Email,
    EmailAddress = "user@example.com",
    EmailSubject = "Verify your email",
    EmailHtmlBody = "<h1>Your OTP: 123456</h1>"
});

Send OTP Email

var (subject, htmlBody) = OtpEmailTemplate.GenerateOtpEmail(
    username: "JohnDoe",
    otp: "123456",
    expiryMinutes: 10,
    purpose: "Password Reset");

await emailSender.SendEmailAsync("user@example.com", subject, htmlBody);

Queue Background Notification

var orchestrator = serviceProvider.GetRequiredService<INotificationOrchestrator>();

await orchestrator.EnqueueAsync(new NotificationMessage
{
    UserId = 123,
    Title = "New message",
    Body = "You have a new message",
    Type = "chat",
    Channel = NotificationChannels.Both,
    EmailAddress = "user@example.com",
    EmailSubject = "New message from Chat",
    EmailHtmlBody = "<p>You have a new message</p>"
});

Dependencies

  • Google.Cloud.Firestore
  • MailKit
  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Microsoft.Extensions.Logging.Abstractions
  • Microsoft.Extensions.Options
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.7.1 112 9/24/2026
2.7.0 105 9/19/2026
2.6.2 188 9/6/2026
2.6.1 108 9/6/2026
2.6.0 97 9/6/2026
2.5.0 105 9/5/2026
2.4.0 109 9/4/2026
2.3.0 118 9/3/2026
2.2.0 134 9/2/2026
2.1.0 99 9/1/2026
2.0.0 100 9/1/2026
1.0.1 99 8/31/2026
1.0.0 97 8/31/2026
0.1.0 118 8/30/2026