FS.Push
9.3.0
dotnet add package FS.Push --version 9.3.0
NuGet\Install-Package FS.Push -Version 9.3.0
<PackageReference Include="FS.Push" Version="9.3.0" />
paket add FS.Push --version 9.3.0
#r "nuget: FS.Push, 9.3.0"
// Install FS.Push as a Cake Addin #addin nuget:?package=FS.Push&version=9.3.0 // Install FS.Push as a Cake Tool #tool nuget:?package=FS.Push&version=9.3.0
Push Notification Service
Overview
This NuGet package provides a convenient and efficient way to send push notifications using Firebase's HTTP v1 API. The service allows you to send push notifications to devices or topics by making REST API calls, following the updated HTTP v1 guidelines from Firebase documentation. This package is ideal for .NET 8 and .NET 9 applications and offers flexibility for configuring notification content, priority, TTL, and other parameters.
Features
- Cross-platform support for .NET 8 and .NET 9
- Push notifications using Firebase's HTTP v1 API (no dependency on FCM or HPNS)
- Supports both topic-based and single-device token notifications
- High flexibility with various configuration options such as priority, TTL, and notification content
- Easy integration with minimal setup required
Installation
To get started, install the NuGet package via the following command:
dotnet add package FS.Push
or search for FS.Push in the NuGet Package Manager.
Example usage
This example demonstrates how to send a push notification using both Firebase and Huawei services. If you wish to send a notification only through Firebase, set the Huawei object to null. Similarly, for Huawei-only notifications, set the Firebase object to null.
string title = "This is title of push";
string body = "This is a message body";
Dictionary<string, string> customData = new()
{
{ "item1", "X" },
{ "item2", "0" },
{ "item3", "value1" }
};
var pushModel = new PushModel()
{
Settings = new PushSettingsModel()
{
Firebase = new PushFirebaseSettingsModel()
{
ClientEmail = "firebase_client_email",
PrivateKey = "firebase_project_id",
ProjectId = "firebase_private_key",
Topics = ["topic1", "topic2"]
},
Huawei = new PushHuaweiSettingsModel()
{
ClientId = "huawei_client_id",
ClientSecret = "huawei_client_secret",
Topics = ["topic1", "topic3", "topic4"]
}
},
Message = new PushMessageModel()
{
Priority = "high",
Ttl = "86400s",
Category = "category",
Sound = "default",
Notification = new PushNotificationModel()
{
Title = title,
Body = body
},
Data = customData
}
};
var results = await PushService.SendAsync(pushModel);
foreach (var result in results)
{
Console.WriteLine($"Provider: {result.Provider}");
Console.WriteLine($"Status Code: {result.StatusCode}");
Console.WriteLine($"Topics or Tokens: {result.TopicsOrTokens}");
Console.WriteLine($"Success: {result.Success}");
Console.WriteLine($"Response: {result.Response}");
if (!string.IsNullOrEmpty(result.Debug))
Console.WriteLine($"Debug Info: {result.Debug}");
Console.WriteLine();
}
Firebase Authentication
- ClientEmail: Your Firebase client email
- ProjectId: Your Firebase project ID
- PrivateKey: Your Firebase private key
- Topics: List of topics to target for push notifications
Huawei Authentication
- ClientId: Your Huawei client ID
- ClientSecret: Your Huawei client secret
- Topics: List of topics for Huawei push notifications
Changelog
[9.3.0]
- Serialization refactory
[9.2.0]
- JSON array response instead of string array
[9.1.4]
- Firebase & Huawei topics/tokens array fixed
[9.1.3]
- iOS mutable content property fixed
[9.1.2]
- Minor fixes
[9.1.1]
- Minor fixes
[9.1.0]
- System.IdentityModel.Tokens.Jwt → 8.3.1 update
- Compatibility interrupted for .Net 6 and 7 versions
[9.0.2]
- System.IdentityModel.Tokens.Jwt → 8.3.0 update
[9.0.1]
- System.IdentityModel.Tokens.Jwt → 8.2.1 update
[9.0.0]
- .NET 9 compliant
[8.7.0]
- Refactory sendasync method
- JSON format string result
[8.6.1]
- System.IdentityModel.Tokens.Jwt → 8.1.2 update
- Minor fix
[8.6.0]
- Api rest policy retry added
- System.IdentityModel.Tokens.Jwt → 8.1.1 update
[8.5.0]
- Added silent push
[8.4.5]
- Huawei click action fix
[8.4.4]
- Minor fix
[8.4.3]
- Minor fix
[8.4.2]
- Minor fix
[8.4.1]
- Minor fix
[8.4.0]
- Moved 'click action' method into auth classes
[8.3.3]
- Huawei click to action minor fix
[8.3.2]
- Huawei payload minor fix
[8.3.1]
- Minor fix
[8.3.0]
- Added content-available and priority properties
- Renamed Huawei property to Android property
[8.2.0]
- Push object refactory (see example)
- Huawei fix
[8.1.2]
- Minor fix
[8.1.1]
- Minor fix
[8.1.0]
- Added Huawei push service
[8.0.0]
- Firebase push with topics or single device token
License
MIT License
Copyright (c) 2019 FRΛƝCƎƧCØ ƧØЯRƎƝTIƝØ
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Support
If you find this package useful, feel free to support the author by offering a coffee or donating with PayPal
Product | Versions 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 is compatible. 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. |
-
net8.0
- Polly (>= 8.5.2)
- System.IdentityModel.Tokens.Jwt (>= 8.5.0)
-
net9.0
- Polly (>= 8.5.2)
- System.IdentityModel.Tokens.Jwt (>= 8.5.0)
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 |
---|---|---|
9.3.0 | 35 | 2/19/2025 |
9.2.0 | 106 | 2/7/2025 |
9.1.4 | 80 | 2/7/2025 |
9.1.3 | 62 | 2/6/2025 |
9.1.2 | 65 | 2/6/2025 |
9.1.1 | 66 | 2/6/2025 |
9.1.0 | 127 | 1/23/2025 |
9.0.2 | 193 | 12/13/2024 |
9.0.1 | 359 | 11/18/2024 |
9.0.0 | 105 | 11/13/2024 |
8.7.0 | 114 | 11/8/2024 |
8.6.1 | 362 | 10/15/2024 |
8.6.0 | 159 | 10/8/2024 |
8.5.0 | 189 | 10/2/2024 |
8.4.5 | 136 | 9/30/2024 |
8.4.4 | 105 | 9/26/2024 |
8.4.1 | 115 | 9/26/2024 |
8.4.0 | 140 | 9/24/2024 |
8.3.3 | 112 | 9/24/2024 |
8.3.2 | 113 | 9/24/2024 |
8.3.1 | 155 | 9/17/2024 |
8.3.0 | 121 | 9/16/2024 |
8.2.0 | 99 | 9/3/2024 |
8.1.2 | 105 | 9/2/2024 |
8.1.1 | 134 | 8/16/2024 |
8.1.0 | 134 | 8/16/2024 |
8.0.0 | 130 | 8/14/2024 |