AQZ.Firebase.Toolkit
3.6.0
dotnet add package AQZ.Firebase.Toolkit --version 3.6.0
NuGet\Install-Package AQZ.Firebase.Toolkit -Version 3.6.0
<PackageReference Include="AQZ.Firebase.Toolkit" Version="3.6.0" />
<PackageVersion Include="AQZ.Firebase.Toolkit" Version="3.6.0" />
<PackageReference Include="AQZ.Firebase.Toolkit" />
paket add AQZ.Firebase.Toolkit --version 3.6.0
#r "nuget: AQZ.Firebase.Toolkit, 3.6.0"
#:package AQZ.Firebase.Toolkit@3.6.0
#addin nuget:?package=AQZ.Firebase.Toolkit&version=3.6.0
#tool nuget:?package=AQZ.Firebase.Toolkit&version=3.6.0
AQZ.Firebase.Toolkit
Production-grade Firebase Cloud Messaging (push notifications) for .NET 10. One dependency (FirebaseAdmin), no ASP.NET requirement - works in web APIs, workers, functions and console apps.
Install
dotnet add package AQZ.Firebase.Toolkit
Configure (appsettings.json)
"Firebase": {
"ProjectId": "my-project",
"CredentialsEnvironmentVariable": "FIREBASE_CREDENTIALS_JSON"
}
The service-account JSON never lives in configuration. Supply it as raw JSON in
an environment variable, as a file path outside source control
(CredentialsPath), or use Application Default Credentials inside GCP
(UseApplicationDefaultCredentials: true).
Register
builder.Services.AddFirebaseToolkit(builder.Configuration);
Send
// Targeted: batching over FCM's 500-token limit is automatic
var result = await push.SendAsync(tokens, new PushMessage { Title = "Hi", Body = "New message" });
// Dead tokens are reported so you can keep your device table clean
foreach (var dead in result.InvalidTokens) await devices.RemoveTokenAsync(dead);
// Broadcast: ONE call regardless of audience size
await push.SendToTopicAsync("all-users", new PushMessage { Title = "News", Body = "..." });
await push.SubscribeToTopicAsync(tokens, "all-users");
// Combine segments in a single call (up to five topics)
await push.SendToConditionAsync("'news' in topics && 'urdu' in topics", message);
Platform payloads
Set these or notifications misbehave on real devices:
new PushMessage {
Title = "Hi", Body = "...",
Android = new AndroidOptions { ChannelId = "chat", Sound = "default", HighPriority = true },
Ios = new IosOptions { Badge = 3, Sound = "default", ThreadId = "chat-42" }
}
ChannelId is required on Android 8+ - without it a notification can be dropped or shown silently. Badge, sound and thread id are what make iOS feel native.
Why topics matter
FCM has no true batch endpoint: a multicast send costs one HTTP request per
token. Addressing a whole user base by token takes hours and burns quota, so
SendAsync refuses audiences over Messaging:MaxTokensPerSend (10,000) and
points you at SendToTopicAsync, which fans out server-side in a single call.
Failure behaviour
- Fail-open by default: a delivery outage never breaks the request that triggered it
- Transient errors (503, 429, socket resets) retried with exponential backoff and jitter
- Logical errors propagate unchanged - never disguised as an outage
- Optional
INotificationOutboxseam for durable retry, with no storage dependency
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- FirebaseAdmin (>= 3.5.0)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.0)
- Microsoft.Extensions.Hosting (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
3.6.0: IUserPushService gains a BroadcastAsync overload that excludes a caller-supplied set of user ids (BroadcastAsync(message, excludeUserIds, ct)), so a consuming app can honour a per-user notification preference on broadcast without the toolkit knowing what a preference is. Backed by a new repository query (GetActiveTokensPagedExcludingUsersAsync). No schema change, no migration; non-breaking. 3.5.0: the send audit gains a first-class Category (event-type) column on FirebaseNotificationDispatches, populated from the message data key (FirebaseStoreOptions.CategoryDataKey, default "category") and filterable via NotificationDispatchQuery.Category, so admin history can be filtered by event type without parsing JSON. Adds a column + index: generate one store migration after upgrading. Non-breaking. 3.4.0: complete send auditing across all audiences (Users, Broadcast, Tokens, Topic, Condition) into FirebaseNotificationDispatches. 3.3.0: data/options types unsealed for inheritance.