OneSignal.net 1.0.2-beta-g1e50fa246a

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

// Install OneSignal.net as a Cake Tool
#tool nuget:?package=OneSignal.net&version=1.0.2-beta-g1e50fa246a&prerelease

OneSignal Logo

OneSignal.net

OneSignal.net is a sync/async .NET 4.6.1+ client for the OneSignal API

Install via NuGet

PM> Install-Package OneSignal.net

How to use

Initialize OneSignal.net

// This only has to be set once.
// Recommended to set in the constructor of the calling class
OneSignalConfiguration.SetupApiKey("ApiKey");
OneSignalConfiguration.SetAppId("AppId");

// All calls that require an app Id have an optional parameter to override what is set in the configuration

Sending a notification with a template

var notificationService = new NotificationService();

var createOptions = new CreateNotificationOptions {
   TemplateId = "TemplateId",
   IncludePlayerIds = new List<string> {
      "playerId1",
      "playerId2"
   }
};

var response = await notificationService.CreateAsync();
Console.WriteLine(response.Id);

Sending a notification with content

var notificationService = new NotificationService();

var createOptions = new CreateNotificationOptions {
   Content = new Dictionary<string, string> {
      { LanguageCode.English, "This is the content for English" }
   },
   Headings = new Dictionary<string, string> {
      { LanguageCode.English, "This is the heading for English" }
   },
   Subtitle = new Dictionary<string, string> {
      { LanguageCode.English, "This is the subtitle for English" }
   },
   IncludeExternalUserIds = new List<string> {
      "userId1",
      "userId2"
   }
};

var response = await notificationService.CreateAsync();
Console.WriteLine(response.Id);

Sending a notification based on a filter

var notificationService = new NotificationService();

var createOptions = new CreateNotificationOptions {
   TemplateId = "TemplateId",
   Filters = new List<NotificationFilter> {
      new NotificationFilterAppVersion(RelationType.GreaterThan, "1.0.0"),
      NotificationFilterOperator.AND,
      new NotificationFilterTag("registered", RelationType.EqualTo, "true")
   }
};

var response = await notificationService.CreateAsync();
Console.WriteLine(response.Id);

Sending an email

var notificationService = new NotificationService();

var createOptions = new CreateNotificationOptions {
   TemplateId = "TemplateId",
   // You can also use any other inclusion options such as player ids, external user ids, filters, segments, etc..
   IncludeEmailTokens = new List<string> {
      "emailToken1",
      "emailToken2"
   },
   EmailSubject = "Test email subject"
};

var response = await notificationService.CreateAsync();
Console.WriteLine(response.Id);

OneSignal Api Oficial Documentation

OneSignal Server API

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.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
1.0.6 7,073 2/23/2021
1.0.5 359 1/6/2021
1.0.4-beta-g791b5f0f6d 221 1/6/2021
1.0.3-beta-g6f6007db1c 225 1/6/2021
1.0.2-beta-g1e50fa246a 203 1/6/2021