Novu 0.1.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Novu --version 0.1.2
NuGet\Install-Package Novu -Version 0.1.2
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.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Novu --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Novu, 0.1.2"
#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.1.2
// Install Novu as a Cake Tool
#tool nuget:?package=Novu&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Novu.NET
Getting Started
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);
var subscribers = await novu.Subscribers.GetSubscribers();
Examples
Novu Client
using Novu.DTO;
using Novu.Models;
using Novu;
...
var config = new NovuClientConfiguration
{
ApiKey = "my-key",
};
var client = new NovuClient(config);
Subscribers
Get Subscribers
using Novu.DTO;
using Novu.Models;
using Novu;
...
var subscribers = await client.Subscriber.GetSubscribers()
Get Subscriber
using Novu.DTO;
using Novu.Models;
using Novu;
...
var subscriber = await client.Subscriber.GetSubscriber("subscriberId");
Create Subscriber
using Novu.DTO;
using Novu.Models;
using Novu;
...
var additionalData = new List<AdditionalDataDto>
{
new AdditionalDataDto
{
Key = "External ID",
Value = "1122334455"
},
{
Key = "SMS_PREFERENCE",
Value = "EMERGENT_ONLY"
}
};
var newSubscriberDto = new CreateSubscriberDto
{
SubscriberId = Guid.NewGuid().ToString(),
FirstName = "John",
LastName = "Doe",
Avatar = "https://unslpash.com/random",
Email = "jdoe@novu.co",
Locale = "en-US",
Phone = "+11112223333",
Data = additionalData
};
var subscriber = await client.Subcriber.CreateSubscriber()
Update Subscriber
using Novu.DTO;
using Novu.Models;
using Novu;
...
var subscriber = client.Subscriber.GetSubscriber("subscriberId");
subscriber.FirstName = "Updated";
subscriber.LastName = "Subscriber";
var updatedSubscriber = await client.Subscriber.UpdateSubscriber(subscriber);
Delete Subscriber
using Novu.DTO;
using Novu.Models;
using Novu;
...
var deleted = await client.Subscriber.DeleteSubscriber("subscriberId");
Update Online Status
using Novu.DTO;
using Novu.Models;
using Novu;
...
var onlineDto = new SubscriberOnlineDto
{
IsOnline = true
};
var online = await client.Subscriber.UpdateOnlineStatus("subscriberId", onlineDto);
Events
Trigger
using Novu.DTO; using Novu.Models; using Novu; ...
// OnboardEventPayload.cs
public class OnboardEventPayload
{
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("welcomeMessage")]
public string WelcomeMessage { get; set; }
}
// MyFile.cs
var onboardingMessage = new OnboardEventPayload
{
Username = "jdoe",
WelcomeMessage = "Welcome to novu-dotnet"
};
var payload = new EventTriggerDataDto()
{
EventName = "onboarding",
To = { SubscriberId = "subscriberId" },
Payload = onboardingMessage
};
var trigger = await client.Event.Trigger(payload);
if (trigger.TriggerResponsePayloadDto.Acknowledged)
{
Console.WriteLine("Trigger has been created.");
}
Trigger Bulk
using Novu.DTO;
using Novu.Models;
using Novu;
...
var payload = new List<EventTriggerDataDto>()
{
new()
{
EventName = "test",
To = { SubscriberId = subscriber.SubscriberId},
Payload = new TestRecord(){ Message = "Hello"}
},
new()
{
EventName = "test",
To = { SubscriberId = subscriber.SubscriberId},
Payload = new TestRecord(){ Message = "World"}
},
};
var trigger = await client.Event.TriggerBulkAsync(payload);
Broadcast Trigger
using Novu.DTO;
using Novu.Models;
using Novu;
...
var testRecord = new TestRecord
{
Message = "This is a test message"
};
var dto = new EventTriggerDataDto()
{
EventName = "test",
To =
{
SubscriberId = subscriber.SubscriberId
},
Payload = testRecord
};
var trigger = await client.Event.TriggerBroadcastAsync(dto);
Cancel Trigger
using Novu.DTO;
using Novu.Models;
using Novu;
...
var cancelled = await client.Event.TriggerCancelAsync("triggerTransactionId");
Repository Overview
All code is located under the src
directory and this will service as the project root.
Novu.NET
is the main SDK with Novu.NET.Tests
housing all unit tests.
Novu.NET
Clients
directory holds all clients that house the actual implementation of the various API calls.DTO
directory holds all Data Transfer ObjectsExceptions
directory holds the custom exception creationsInterfaces
directory holds all interfaces that are inteded to outline how a class should be structured.Models
directory holds various modelsUtilities
directory holds various utility functions used around the project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
- RestSharp (>= 109.0.1)
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.