ntfy 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ntfy --version 0.2.0                
NuGet\Install-Package ntfy -Version 0.2.0                
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="ntfy" Version="0.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ntfy --version 0.2.0                
#r "nuget: ntfy, 0.2.0"                
#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.
// Install ntfy as a Cake Addin
#addin nuget:?package=ntfy&version=0.2.0

// Install ntfy as a Cake Tool
#tool nuget:?package=ntfy&version=0.2.0                

ntfy-dotnet


A .NET library for ntfy, allowing sending and receiving messages.

Useful for:

  • Xamarin (mobile) apps
  • .NET apps
  • C# scripts

Installation

Download the latest release from the releases page or from NuGet.

Usage

Sending a message
using ntfy;

// Create a new client
var client = new Client("https://ntfy.sh");

// Publish a message to the "test" topic
var message = new SendingMessage
        {
            Title = "This is a demo.",
            Actions = new Actions.Action[]
            {
                new Broadcast("label")
                {
                },
                new View("label2", new Uri("https://google.com"))
                {
                }
            }
        };

await client.Publish("test", message);
Receiving a message
using ntfy;

// Create a new client
var client = new Client("https://ntfy.sh");

// Fiter messages by priority
var filter = new Filter
{
    Priorities = new PriorityLevel[] { Priority.High },
};

// Filter messages since 1 hour ago
var since = new Since(new DelayDuration(1, DelayUnit.Hours));

// Subscribe to the "test" topic
var subscription = client.Subscribe(new string[] { "test" }, since: since, filters: filter);

// Process a new message when it arrives
await foreach (var message in subscription.WithCancellation(default))
{
    // Do something with the message
}
Users

You can specify a specific user for sending and receiving messages on private topics.

using ntfy;

// Create a new user
var user = new User("username", "password");

// Pass this user into the Subscribe, Publish, Poll methods

// Verify that the user has access to the "test" topic
var client = new Client("https://ntfy.sh");
bool allowed = await client.CheckAuthentication("test", user);

// You can also call this method without a user to see if the topic is anonymously accessible

Documentation

See the documentation for more information.

Dependencies

  • Microsoft.Bcl.AsyncInterfaces
  • N8.NetTools.HTTP

Supported Frameworks

  • .NET Standard 2.0
  • .NET Standard 2.1
  • .NET Core 3.1
  • .NET 5.0
  • .NET 6.0
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
0.5.0 1,521 8/8/2023
0.4.0 178 7/6/2023
0.3.0 631 11/30/2022
0.2.0 433 10/30/2022
0.1.0 440 10/19/2022