(subscribers.notifications)
- retrieve - Get in-app notification feed for a particular subscriber
- unseenCount - Get the unseen in-app notifications count for subscribers feed
Get in-app notification feed for a particular subscriber
import { Novu } from "@novu/api";
const novu = new Novu({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await novu.subscribers.notifications.retrieve({
subscriberId: "<value>",
payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { NovuCore } from "@novu/api/core.js";
import { subscribersNotificationsRetrieve } from "@novu/api/funcs/subscribersNotificationsRetrieve.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 subscribersNotificationsRetrieve(novu, {
subscriberId: "<value>",
payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SubscribersControllerGetNotificationsFeedRequest | ✔️ | 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.SubscribersControllerGetNotificationsFeedResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get the unseen in-app notifications count for subscribers feed
import { Novu } from "@novu/api";
const novu = new Novu({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await novu.subscribers.notifications.unseenCount({
seen: true,
subscriberId: "<value>",
limit: 4322.81,
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { NovuCore } from "@novu/api/core.js";
import { subscribersNotificationsUnseenCount } from "@novu/api/funcs/subscribersNotificationsUnseenCount.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 subscribersNotificationsUnseenCount(novu, {
seen: true,
subscriberId: "<value>",
limit: 4322.81,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SubscribersControllerGetUnseenCountRequest | ✔️ | 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<components.UnseenCountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |