API Reference
Notifications
Integrations
Subscribers
- GETGet subscribers
- POSTBulk create subscribers
- PUTUpdate subscriber credentials
- PATCHModify subscriber credentials
- DELDelete subscriber credentials by providerId
- PATCHUpdate subscriber online status
- GETGet in-app notification feed for a particular subscriber
- GETGet the unseen in-app notifications count for subscribers feed
- POSTMark a subscriber messages as seen, read, unseen or unread
- POSTMarks 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.
- POSTMark message action as seen
- GETHandle providers oauth redirect
- GETHandle chat oauth
- GETSearch for subscribers
- POSTCreate subscriber
- GETGet subscriber
- DELDelete subscriber
- PATCHPatch subscriber
- GETGet subscriber preferences
- PATCHUpdate subscriber global or workflow specific preferences
Get in-app notification feed for a particular subscriber
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.subscribers.notifications.feed({
subscriberId: "<id>",
payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=",
});
// Handle the result
console.log(result);
}
run();
{
"totalCount": 5,
"hasMore": true,
"data": [
{
"_id": "615c1f2f9b0c5b001f8e4e3b",
"_templateId": "template_12345",
"_environmentId": "env_67890",
"_messageTemplateId": "message_template_54321",
"_organizationId": "org_98765",
"_notificationId": "notification_123456",
"_subscriberId": "subscriber_112233",
"_feedId": "feed_445566",
"_jobId": "job_778899",
"createdAt": "2024-12-10T10:10:59.639Z",
"updatedAt": "2024-12-10T10:10:59.639Z",
"actor": {
"data": null,
"type": "none"
},
"subscriber": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"avatar": "<string>",
"subscriberId": "<string>"
},
"transactionId": "transaction_123456",
"templateIdentifier": "template_abcdef",
"providerId": "provider_xyz",
"content": "This is a test notification content.",
"subject": "Test Notification Subject",
"channel": "in_app",
"read": false,
"seen": true,
"deleted": false,
"deviceTokens": [
"token1",
"token2"
],
"cta": {
"type": "redirect",
"data": {
"url": "<string>"
},
"action": {
"status": "pending",
"buttons": [
{
"type": "primary",
"content": "<string>",
"resultContent": "<string>"
}
],
"result": {
"payload": {},
"type": "primary"
}
}
},
"status": "sent",
"payload": {
"key": "value"
},
"overrides": {
"overrideKey": "overrideValue"
}
}
],
"pageSize": 2,
"page": 1
}
Authorizations
API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".
Headers
A header for idempotency purposes
Path Parameters
Query Parameters
x < 100
Base64 encoded string of the partial payload JSON object
Response
Indicates if there are more notifications to load.
Array of notifications returned in the response.
Unique identifier for the notification.
Identifier for the template used to generate the notification.
Identifier for the environment where the notification is sent.
Identifier for the message template used.
Identifier for the organization sending the notification.
Unique identifier for the notification instance.
Unique identifier for the subscriber receiving the notification.
Identifier for the feed associated with the notification.
Identifier for the job that triggered the notification.
Unique identifier for the transaction associated with the notification.
The main content of the notification.
Channel type through which the message is sent
in_app
, email
, sms
, chat
, push
Indicates whether the notification has been read by the subscriber.
Indicates whether the notification has been seen by the subscriber.
Indicates whether the notification has been deleted.
Call-to-action information associated with the notification.
Data associated with the call to action
URL for the call to action
Type of call to action
redirect
Action associated with the call to action
Status of the message action
pending
, done
List of buttons associated with the message action
Current status of the notification.
sent
, error
, warning
Timestamp indicating when the notification was created.
Timestamp indicating when the notification was last updated.
Actor details related to the notification, if applicable.
Subscriber details associated with this notification.
The identifier used to create this subscriber, which typically corresponds to the user ID in your system.
The internal ID generated by Novu for your subscriber. This ID does not match the subscriberId
used in your queries. Refer to subscriberId
for that identifier.
The first name of the subscriber.
The last name of the subscriber.
The URL of the subscriber's avatar image.
Identifier for the template used, if applicable.
Identifier for the provider that sends the notification.
The subject line for email notifications, if applicable.
Device tokens for push notifications, if applicable.
The payload that was used to send the notification trigger.
Provider-specific overrides used when triggering the notification.
The number of notifications returned in this response.
The current page number of the notifications.
Total number of notifications available.
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.subscribers.notifications.feed({
subscriberId: "<id>",
payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=",
});
// Handle the result
console.log(result);
}
run();
{
"totalCount": 5,
"hasMore": true,
"data": [
{
"_id": "615c1f2f9b0c5b001f8e4e3b",
"_templateId": "template_12345",
"_environmentId": "env_67890",
"_messageTemplateId": "message_template_54321",
"_organizationId": "org_98765",
"_notificationId": "notification_123456",
"_subscriberId": "subscriber_112233",
"_feedId": "feed_445566",
"_jobId": "job_778899",
"createdAt": "2024-12-10T10:10:59.639Z",
"updatedAt": "2024-12-10T10:10:59.639Z",
"actor": {
"data": null,
"type": "none"
},
"subscriber": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"avatar": "<string>",
"subscriberId": "<string>"
},
"transactionId": "transaction_123456",
"templateIdentifier": "template_abcdef",
"providerId": "provider_xyz",
"content": "This is a test notification content.",
"subject": "Test Notification Subject",
"channel": "in_app",
"read": false,
"seen": true,
"deleted": false,
"deviceTokens": [
"token1",
"token2"
],
"cta": {
"type": "redirect",
"data": {
"url": "<string>"
},
"action": {
"status": "pending",
"buttons": [
{
"type": "primary",
"content": "<string>",
"resultContent": "<string>"
}
],
"result": {
"payload": {},
"type": "primary"
}
}
},
"status": "sent",
"payload": {
"key": "value"
},
"overrides": {
"overrideKey": "overrideValue"
}
}
],
"pageSize": 2,
"page": 1
}