(subscribers.messages)
- markAllAs - Mark a subscriber messages as seen, read, unseen or unread
- markAll - Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
- updateAsSeen - Mark message action as seen
Mark a subscriber messages as seen, read, unseen or unread
import { Novu } from "@novu/api";
const novu = new Novu({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await novu.subscribers.messages.markAllAs({
messageId: "<value>",
markAs: "read",
}, "<id>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { NovuCore } from "@novu/api/core.js";
import { subscribersMessagesMarkAllAs } from "@novu/api/funcs/subscribersMessagesMarkAllAs.js";
// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await subscribersMessagesMarkAllAs(novu, {
messageId: "<value>",
markAs: "read",
}, "<id>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
messageMarkAsRequestDto |
components.MessageMarkAsRequestDto | ✔️ | N/A |
idempotencyKey |
string | ➖ | A header for idempotency purposes |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SubscribersControllerMarkMessagesAsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorDto | 400, 404, 409 | application/json |
errors.ValidationErrorDto | 422 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
import { Novu } from "@novu/api";
const novu = new Novu({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await novu.subscribers.messages.markAll({
markAs: "seen",
}, "<id>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { NovuCore } from "@novu/api/core.js";
import { subscribersMessagesMarkAll } from "@novu/api/funcs/subscribersMessagesMarkAll.js";
// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await subscribersMessagesMarkAll(novu, {
markAs: "seen",
}, "<id>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
markAllMessageAsRequestDto |
components.MarkAllMessageAsRequestDto | ✔️ | N/A |
idempotencyKey |
string | ➖ | A header for idempotency purposes |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SubscribersControllerMarkAllUnreadAsReadResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorDto | 400, 404, 409 | application/json |
errors.ValidationErrorDto | 422 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Mark message action as seen
import { Novu } from "@novu/api";
const novu = new Novu({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await novu.subscribers.messages.updateAsSeen({
messageId: "<id>",
type: "<value>",
subscriberId: "<id>",
markMessageActionAsSeenDto: {
status: "done",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { NovuCore } from "@novu/api/core.js";
import { subscribersMessagesUpdateAsSeen } from "@novu/api/funcs/subscribersMessagesUpdateAsSeen.js";
// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await subscribersMessagesUpdateAsSeen(novu, {
messageId: "<id>",
type: "<value>",
subscriberId: "<id>",
markMessageActionAsSeenDto: {
status: "done",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SubscribersControllerMarkActionAsSeenRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SubscribersControllerMarkActionAsSeenResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorDto | 400, 404, 409 | application/json |
errors.ValidationErrorDto | 422 | application/json |
errors.SDKError | 4XX, 5XX | */* |