Skip to content

Latest commit

 

History

History
730 lines (515 loc) · 52.7 KB

File metadata and controls

730 lines (515 loc) · 52.7 KB

Subscribers.Notifications

Overview

Available Operations

List

Retrieve in-app (inbox) notifications for a subscriber by its unique key identifier subscriberId. Supports filtering by tags, read/archived/snoozed/seen state, data attributes, severity, date range, and context keys.

Example Usage

using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

SubscribersControllerGetSubscriberNotificationsRequest req = new SubscribersControllerGetSubscriberNotificationsRequest() {
    SubscriberId = "<id>",
    Offset = 0D,
    CreatedGte = 1704067200000D,
    CreatedLte = 1735689599999D,
};

var res = await sdk.Subscribers.Notifications.ListAsync(req);

// handle response

Parameters

Parameter Type Required Description
request SubscribersControllerGetSubscriberNotificationsRequest ✔️ The request object to use for the request.

Response

SubscribersControllerGetSubscriberNotificationsResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

Delete

Delete a specific in-app (inbox) notification permanently by its unique identifier notificationId.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.DeleteAsync(
    subscriberId: "<id>",
    notificationId: "<id>"
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
NotificationId string ✔️ The identifier of the notification
ContextKeys List<string> Context keys for filtering
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerDeleteNotificationResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

CompleteAction

Mark a single in-app (inbox) notification's action (primary or secondary) as completed by its unique identifier notificationId and action type actionType.

Example Usage

using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

SubscribersControllerCompleteNotificationActionRequest req = new SubscribersControllerCompleteNotificationActionRequest() {
    SubscriberId = "<id>",
    NotificationId = "<id>",
    ActionType = ActionType.Secondary,
};

var res = await sdk.Subscribers.Notifications.CompleteActionAsync(req);

// handle response

Parameters

Parameter Type Required Description
request SubscribersControllerCompleteNotificationActionRequest ✔️ The request object to use for the request.

Response

SubscribersControllerCompleteNotificationActionResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

RevertAction

Revert a single in-app (inbox) notification's action (primary or secondary) to pending state by its unique identifier notificationId and action type actionType.

Example Usage

using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

SubscribersControllerRevertNotificationActionRequest req = new SubscribersControllerRevertNotificationActionRequest() {
    SubscriberId = "<id>",
    NotificationId = "<id>",
    ActionType = PathParamActionType.Primary,
};

var res = await sdk.Subscribers.Notifications.RevertActionAsync(req);

// handle response

Parameters

Parameter Type Required Description
request SubscribersControllerRevertNotificationActionRequest ✔️ The request object to use for the request.

Response

SubscribersControllerRevertNotificationActionResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

Archive

Archive a specific in-app (inbox) notification by its unique identifier notificationId.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.ArchiveAsync(
    subscriberId: "<id>",
    notificationId: "<id>"
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
NotificationId string ✔️ The identifier of the notification
ContextKeys List<string> Context keys for filtering
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerArchiveNotificationResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

MarkAsRead

Mark a specific in-app (inbox) notification as read by its unique identifier notificationId.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.MarkAsReadAsync(
    subscriberId: "<id>",
    notificationId: "<id>"
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
NotificationId string ✔️ The identifier of the notification
ContextKeys List<string> Context keys for filtering
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerMarkNotificationAsReadResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

Snooze

Snooze a specific in-app (inbox) notification by its unique identifier notificationId until a specified time.

Example Usage

using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
using System;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

SubscribersControllerSnoozeNotificationRequest req = new SubscribersControllerSnoozeNotificationRequest() {
    SubscriberId = "<id>",
    NotificationId = "<id>",
    SnoozeSubscriberNotificationDto = new SnoozeSubscriberNotificationDto() {
        SnoozeUntil = System.DateTime.Parse("2026-03-01T10:00:00Z").ToUniversalTime(),
    },
};

var res = await sdk.Subscribers.Notifications.SnoozeAsync(req);

// handle response

Parameters

Parameter Type Required Description
request SubscribersControllerSnoozeNotificationRequest ✔️ The request object to use for the request.

Response

SubscribersControllerSnoozeNotificationResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

Unarchive

Unarchive a specific in-app (inbox) notification by its unique identifier notificationId.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.UnarchiveAsync(
    subscriberId: "<id>",
    notificationId: "<id>"
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
NotificationId string ✔️ The identifier of the notification
ContextKeys List<string> Context keys for filtering
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerUnarchiveNotificationResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

MarkAsUnread

Mark a specific in-app (inbox) notification as unread by its unique identifier notificationId.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.MarkAsUnreadAsync(
    subscriberId: "<id>",
    notificationId: "<id>"
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
NotificationId string ✔️ The identifier of the notification
ContextKeys List<string> Context keys for filtering
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerMarkNotificationAsUnreadResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

Unsnooze

Unsnooze a specific in-app (inbox) notification by its unique identifier notificationId.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.UnsnoozeAsync(
    subscriberId: "<id>",
    notificationId: "<id>"
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
NotificationId string ✔️ The identifier of the notification
ContextKeys List<string> Context keys for filtering
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerUnsnoozeNotificationResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

ArchiveAll

Archive all in-app (inbox) notifications matching the specified filters. Supports context-based filtering.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.ArchiveAllAsync(
    subscriberId: "<id>",
    updateAllSubscriberNotificationsDto: new UpdateAllSubscriberNotificationsDto() {}
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
UpdateAllSubscriberNotificationsDto UpdateAllSubscriberNotificationsDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerArchiveAllNotificationsResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

Count

Retrieve count of in-app (inbox) notifications for a subscriber by its unique key identifier subscriberId. Supports multiple filters to count in-app (inbox) notifications by different criteria, including context keys.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.CountAsync(
    subscriberId: "<id>",
    filters: "[{\"read\":false,\"archived\":false},{\"tags\":[\"important\"]},{\"tags\":{\"and\":[{\"or\":[\"a\",\"b\"]},{\"or\":[\"c\"]}]}}]"
);

// handle response

Parameters

Parameter Type Required Description Example
SubscriberId string ✔️ The identifier of the subscriber
Filters string ✔️ Array of filter objects (max 30) to count notifications by different criteria [{"read":false,"archived":false},{"tags":["important"]},{"tags":{"and":[{"or":["a","b"]},{"or":["c"]}]}}]
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerGetSubscriberNotificationsCountResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

DeleteAll

Permanently delete all in-app (inbox) notifications matching the specified filters. Supports context-based filtering.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.DeleteAllAsync(
    subscriberId: "<id>",
    updateAllSubscriberNotificationsDto: new UpdateAllSubscriberNotificationsDto() {}
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
UpdateAllSubscriberNotificationsDto UpdateAllSubscriberNotificationsDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerDeleteAllNotificationsResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

MarkAllAsRead

Mark all in-app (inbox) notifications matching the specified filters as read. Supports context-based filtering.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.MarkAllAsReadAsync(
    subscriberId: "<id>",
    updateAllSubscriberNotificationsDto: new UpdateAllSubscriberNotificationsDto() {}
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
UpdateAllSubscriberNotificationsDto UpdateAllSubscriberNotificationsDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerMarkAllNotificationsAsReadResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

ArchiveAllRead

Archive all read in-app (inbox) notifications matching the specified filters. Supports context-based filtering.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.ArchiveAllReadAsync(
    subscriberId: "<id>",
    updateAllSubscriberNotificationsDto: new UpdateAllSubscriberNotificationsDto() {}
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
UpdateAllSubscriberNotificationsDto UpdateAllSubscriberNotificationsDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerArchiveAllReadNotificationsResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*

MarkAsSeen

Mark specific and multiple in-app (inbox) notifications as seen. Supports context-based filtering.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Subscribers.Notifications.MarkAsSeenAsync(
    subscriberId: "<id>",
    markSubscriberNotificationsAsSeenDto: new MarkSubscriberNotificationsAsSeenDto() {}
);

// handle response

Parameters

Parameter Type Required Description
SubscriberId string ✔️ The identifier of the subscriber
MarkSubscriberNotificationsAsSeenDto MarkSubscriberNotificationsAsSeenDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

SubscribersControllerMarkNotificationsAsSeenResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 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 */*