Novu 0.3.3

dotnet add package Novu --version 0.3.3
NuGet\Install-Package Novu -Version 0.3.3
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="Novu" Version="0.3.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Novu --version 0.3.3
#r "nuget: Novu, 0.3.3"
#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 Novu as a Cake Addin
#addin nuget:?package=Novu&version=0.3.3

// Install Novu as a Cake Tool
#tool nuget:?package=Novu&version=0.3.3

<div align="center"> <a href="https://novu.co" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/2233092/213641039-220ac15f-f367-4d13-9eaf-56e79433b8c1.png"> <img src="https://user-images.githubusercontent.com/2233092/213641043-3bbb3f21-3c53-4e67-afe5-755aeb222159.png" width="280" alt="Logo"/> </picture> </a> </div>

novu-dotnet

NuGet NuGet Deploy to Nuget

.NET SDK for Novu - The open-source notification infrastructure for engineers. 🚀

novu-dotnet targets .NET Standard 2.0 and is compatible with .NET Core 2.0+ and .NET Framework 4.6.1+.

Features

  • Bindings against most API endpoints
    • Events, subscribers, notifications, integrations, layouts, topics, workflows, workflow groups, messages, execution details
    • Not Implemented: environments, inbound parse, changes
  • Bootstrap each services as part of services provider or directly as a singleton class (setting injectable)
  • A Sync service that will mirror an environment based a set of templates (layouts, integrations, workflow groups, workflows)

WARNING: 0.3.0 has breaking changes and the tests should be relied on for understanding the client libraries

Dependencies

dotnet novu novu api package Notes
0.2.2 ⇐ 0.17 Singleton client with Refit's use of RestService
0.3.0 >= 0.18 0.3.0 is not compatible with 0.2.2 and requires upgrade to code. Also 0.18 introduced a breaking change only found in 0.3.0. All 0.2.2 must be upgraded if used against the production system. HttpClient can now be used and injected.
0.3.1 >= 0.18 Failed release. You will not find this release on Nuget.
0.3.2 >= 0.18 [BREAKING} Obsolete Notification Templates has been removed. Service registration separation of single client and each client. Novu.Extension and Novu.Sync released as packages.

Installation

dotnet add package Novu

Configuration

Direct instantiation

using Novu.DTO;
using Novu.Models;
using Novu;

 var novuConfiguration = new NovuClientConfiguration
{
    // Defaults to https://api.novu.co/v1
    Url = "https://novu-api.my-domain.com/v1",
    ApiKey = "12345",
};

var novu = new NovuClient(novuConfiguration);

// Note: this client exposes all endpoints as methods but uses RestService
var subscribers = await novu.Subscriber.Get();

Dependency Injection

Configure via settings

{
  "Novu": {
    "Url": "http://localhost:3000/v1",
    "ApiKey": "e36b820fcc9a68a83db6c79c30f1a461"
  }
}

Setup Injection via extension methods


public static IServiceCollection RegisterNotificationSetupServices(
    this IServiceCollection services,
    IConfiguration configuration)
{
    // registers all clients with novu config from appsetting.json
    // the services inject HttpClient
    return services
        .RegisterNovuClients(configuration)
        // here as an example that the registered services are injected into local service
        .AddTransient<NovuNotificationService>();
}

Write your consuming code with the injected clients

// then instantiate via injection
public class NovuNotificationService
{
    private readonly IEventClient _event;

    public NovuSyncService(IEventClient @event)
    {
        _event = @event;
    }

    public async Task Trigger(string subscriberId){
       var trigger = await Event.Trigger(
            new EventCreateData
            {
                EventName = 'event-name',
                To = { SubscriberId =subscriberId },
                Payload = new Payload("Bogus payload"),
            });
    }

    public record Payload(string Message)
    {
        [JsonProperty("message")] public string Message { get; set; }
    }
}

Examples

Usage of the library is best understood by looking at the tests.

  • Integration Tests: these show the minimal dependencies required to do one primary request (create, update, delete)
  • Acceptance Tests: these show a sequence of actions to complete a business process in an environment

Repository Overview

Novu is the main SDK with Novu.Tests housing all unit tests. Novu.Extensions is required for DI and Novu.Sync if your are looking for mirroring environments.

novu-dotnet

The key folders to look into:

  • DTO directory holds all objects needed to use the clients
  • Interfaces directory holds all interfaces that are intended to outline how a class should be structured
  • Models directory holds various models that are sub-resources inside the DTOs

Major changes

Github issues closed

0.3.1
  • #57
  • #58
  • #59
  • #60
  • #55
0.3.0
  • #19
  • #20
  • #21
  • #34
  • #48
  • #49
  • #50
  • #47
  • #45
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 (2)

Showing the top 2 NuGet packages that depend on Novu:

Package Downloads
Novu.Extensions

Novu .NET SDK

Novu.Sync

Novu .NET SDK

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.3 21,063 9/15/2023
0.3.2 366 8/28/2023
0.3.0 788 8/25/2023
0.2.2 2,216 7/10/2023
0.2.1 4,462 6/2/2023
0.2.0 362 5/9/2023
0.1.9 123 5/5/2023
0.1.8 128 5/5/2023
0.1.3 124 5/1/2023
0.1.2 133 5/1/2023
0.1.1 137 5/1/2023
0.1.0 118 5/1/2023