Novu 2.2.0
See the version list below for details.
dotnet add package Novu --version 2.2.0
NuGet\Install-Package Novu -Version 2.2.0
<PackageReference Include="Novu" Version="2.2.0" />
<PackageVersion Include="Novu" Version="2.2.0" />
<PackageReference Include="Novu" />
paket add Novu --version 2.2.0
#r "nuget: Novu, 2.2.0"
#:package Novu@2.2.0
#addin nuget:?package=Novu&version=2.2.0
#tool nuget:?package=Novu&version=2.2.0
Novu
SDK Example Usage
Trigger Notification Event
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
});
// handle response
Cancel Triggered Event
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.CancelAsync(transactionId: "<id>");
// handle response
Broadcast Event to All
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.BroadcastAsync(triggerEventToAllRequestDto: new TriggerEventToAllRequestDto() {
Name = "<value>",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new TriggerEventToAllRequestDtoOverrides() {
AdditionalProperties = new Dictionary<string, Dictionary<string, object>>() {
{ "fcm", new Dictionary<string, object>() {
{ "data", new Dictionary<string, object>() {
{ "key", "value" },
} },
} },
},
},
});
// handle response
Trigger Notification Events in Bulk
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.TriggerBulkAsync(bulkTriggerEventDto: new BulkTriggerEventDto() {
Events = new List<TriggerEventRequestDto>() {
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
},
});
// handle response
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
SecretKey |
apiKey | API key |
To authenticate with the API the SecretKey
parameter must be set when initializing the SDK client instance. For example:
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
});
// handle response
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply pass a RetryConfig
to the call:
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.TriggerAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
}
);
// handle response
If you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig
optional parameter when intitializing the SDK:
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
secretKey: "YOUR_SECRET_KEY_HERE"
);
var res = await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
});
// handle response
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default, an API error will raise a Novu.Models.Errors.APIException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | The error message |
Request |
HttpRequestMessage | The HTTP request |
Response |
HttpResponseMessage | The HTTP response |
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the TriggerAsync
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
Novu.Models.Errors.PayloadValidationExceptionDto | 400 | application/json |
Novu.Models.Errors.ErrorDto | 414 | application/json |
Novu.Models.Errors.ErrorDto | 401, 403, 404, 405, 409, 413, 415 | application/json |
Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
Novu.Models.Errors.ErrorDto | 500 | application/json |
Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Example
using Novu;
using Novu.Models.Components;
using Novu.Models.Errors;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
try
{
var res = await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
});
// handle response
}
catch (Exception ex)
{
if (ex is PayloadValidationExceptionDto)
{
// Handle exception data
throw;
}
else if (ex is ErrorDto)
{
// Handle exception data
throw;
}
else if (ex is ErrorDto)
{
// Handle exception data
throw;
}
else if (ex is ValidationErrorDto)
{
// Handle exception data
throw;
}
else if (ex is ErrorDto)
{
// Handle exception data
throw;
}
else if (ex is Novu.Models.Errors.APIException)
{
// Handle default exception
throw;
}
}
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the serverIndex: int
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Description |
---|---|---|
0 | https://api.novu.co |
|
1 | https://eu.api.novu.co |
Example
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(
serverIndex: 1,
secretKey: "YOUR_SECRET_KEY_HERE"
);
var res = await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
});
// handle response
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the serverUrl: string
optional parameter when initializing the SDK client instance. For example:
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(
serverUrl: "https://eu.api.novu.co",
secretKey: "YOUR_SECRET_KEY_HERE"
);
var res = await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
});
// handle response
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 was computed. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- newtonsoft.json (>= 13.0.3)
- nodatime (>= 3.1.9)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Novu:
Package | Downloads |
---|---|
Novu.Extensions
Novu .NET SDK |
|
Novu.Sync
Novu .NET SDK |
|
TechAppBuilder.Complete
Complete TechAppBuilder suite with core TAB components for .NET 5.0 applications including Core, Common, CheckIn, CustomHookManager, Media, and TQL modules |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.3.0-alpha.1 | 439 | 6/25/2025 |
2.2.0 | 2,427 | 6/17/2025 |
2.1.0 | 1,104 | 5/22/2025 |
1.0.6 | 504 | 5/2/2025 |
1.0.5 | 262 | 5/2/2025 |
1.0.4 | 275 | 5/2/2025 |
1.0.3 | 281 | 5/2/2025 |
0.6.1 | 1,662 | 4/25/2025 |
0.6.0 | 6,541 | 2/18/2025 |
0.5.0 | 240 | 2/18/2025 |
0.4.2 | 249 | 2/17/2025 |
0.4.1 | 191 | 2/14/2025 |
0.4.0 | 277 | 2/8/2025 |
0.3.3 | 101,237 | 9/15/2023 |
0.3.2 | 483 | 8/28/2023 |
0.3.0 | 907 | 8/25/2023 |
0.2.2 | 6,304 | 7/10/2023 |
0.2.1 | 6,346 | 6/2/2023 |
0.2.0 | 461 | 5/9/2023 |
0.1.9 | 199 | 5/5/2023 |
0.1.8 | 203 | 5/5/2023 |
0.1.3 | 196 | 5/1/2023 |
0.1.2 | 210 | 5/1/2023 |
0.1.1 | 218 | 5/1/2023 |
0.1.0 | 203 | 5/1/2023 |