Novu 2.3.0
dotnet add package Novu --version 2.3.0
NuGet\Install-Package Novu -Version 2.3.0
<PackageReference Include="Novu" Version="2.3.0" />
<PackageVersion Include="Novu" Version="2.3.0" />
<PackageReference Include="Novu" />
paket add Novu --version 2.3.0
#r "nuget: Novu, 2.3.0"
#:package Novu@2.3.0
#addin nuget:?package=Novu&version=2.3.0
#tool nuget:?package=Novu&version=2.3.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;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.InboundWebhooksControllerHandleWebhookAsync(
environmentId: "<id>",
integrationId: "<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;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.InboundWebhooksControllerHandleWebhookAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
environmentId: "<id>",
integrationId: "<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;
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.InboundWebhooksControllerHandleWebhookAsync(
environmentId: "<id>",
integrationId: "<id>"
);
// handle response
Error Handling
NovuError
is the base exception class for all HTTP error responses. It has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | Error message |
Request |
HttpRequestMessage | HTTP request object |
Response |
HttpResponseMessage | HTTP response object |
Some exceptions in this SDK include an additional Payload
field, which will contain deserialized custom error data when present. Possible exceptions are listed in the Error Classes section.
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 (NovuError ex) // all SDK exceptions inherit from NovuError
{
// ex.ToString() provides a detailed error message
System.Console.WriteLine(ex);
// Base exception fields
HttpRequestMessage request = ex.Request;
HttpResponseMessage response = ex.Response;
var statusCode = (int)response.StatusCode;
var responseBody = ex.Body;
if (ex is PayloadValidationExceptionDto) // different exceptions may be thrown depending on the method
{
// Check error data fields
PayloadValidationExceptionDtoPayload payload = ex.Payload;
double StatusCode = payload.StatusCode;
string Timestamp = payload.Timestamp;
// ...
}
// An underlying cause may be provided
if (ex.InnerException != null)
{
Exception cause = ex.InnerException;
}
}
catch (System.Net.Http.HttpRequestException ex)
{
// Check ex.InnerException for Network connectivity errors
}
Error Classes
Primary exceptions:
NovuError
: The base class for HTTP error responses.ErrorDto
: *ValidationErrorDto
: Unprocessable Entity. Status code422
. *
<details><summary>Less common exceptions (5)</summary>
System.Net.Http.HttpRequestException
: Network connectivity error. For more details about the underlying cause, inspect theex.InnerException
.Inheriting from
NovuError
:PayloadValidationExceptionDto
: Status code400
. Applicable to 3 of 75 methods.*SubscriberResponseDto
: Created. Status code409
. Applicable to 1 of 75 methods.*TopicResponseDto
: OK. Status code409
. Applicable to 1 of 75 methods.*ResponseValidationError
: Thrown when the response data could not be deserialized into the expected type. </details>
* Refer to the relevant documentation to determine whether an exception applies to a specific operation.
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;
var sdk = new NovuSDK(
serverIndex: 1,
secretKey: "YOUR_SECRET_KEY_HERE"
);
var res = await sdk.InboundWebhooksControllerHandleWebhookAsync(
environmentId: "<id>",
integrationId: "<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;
var sdk = new NovuSDK(
serverUrl: "https://eu.api.novu.co",
secretKey: "YOUR_SECRET_KEY_HERE"
);
var res = await sdk.InboundWebhooksControllerHandleWebhookAsync(
environmentId: "<id>",
integrationId: "<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 | 215 | 9/17/2025 |
2.3.0-alpha.1 | 607 | 6/25/2025 |
2.2.0 | 3,623 | 6/17/2025 |
2.1.0 | 1,153 | 5/22/2025 |
1.0.6 | 595 | 5/2/2025 |
1.0.5 | 282 | 5/2/2025 |
1.0.4 | 295 | 5/2/2025 |
1.0.3 | 302 | 5/2/2025 |
0.6.1 | 1,789 | 4/25/2025 |
0.6.0 | 7,308 | 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 | 111,208 | 9/15/2023 |
0.3.2 | 487 | 8/28/2023 |
0.3.0 | 920 | 8/25/2023 |
0.2.2 | 6,394 | 7/10/2023 |
0.2.1 | 6,352 | 6/2/2023 |
0.2.0 | 474 | 5/9/2023 |
0.1.9 | 207 | 5/5/2023 |
0.1.8 | 211 | 5/5/2023 |
0.1.3 | 204 | 5/1/2023 |
0.1.2 | 218 | 5/1/2023 |
0.1.1 | 226 | 5/1/2023 |
0.1.0 | 211 | 5/1/2023 |