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 subscribers
Returns a list of subscribers, could paginated using the page
and limit
query parameter
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.subscribers.list();
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
{
"page": 123,
"hasMore": true,
"pageSize": 123,
"data": [
{
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"subscriberId": "<string>",
"channels": [
{
"providerId": "slack",
"integrationIdentifier": "<string>",
"credentials": {
"webhookUrl": "https://example.com/webhook",
"channel": "general",
"deviceTokens": [
"token1",
"token2",
"token3"
],
"alertUid": "12345-abcde",
"title": "Critical Alert",
"imageUrl": "https://example.com/image.png",
"state": "resolved",
"externalUrl": "https://example.com/details"
},
"_integrationId": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"_organizationId": "<string>",
"_environmentId": "<string>",
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
}
]
}
Authorizations
API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".
Headers
A header for idempotency purposes
Response
The current page of the paginated response
Does the list have more items to fetch
Number of items on each page
The list of items matching the query
The identifier used to create this subscriber, which typically corresponds to the user ID in your system.
The unique identifier of the organization to which the subscriber belongs.
The unique identifier of the environment associated with this subscriber.
Indicates whether the subscriber has been deleted.
The timestamp indicating when the subscriber was created, in ISO 8601 format.
The timestamp indicating when the subscriber was last updated, in ISO 8601 format.
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 email address of the subscriber.
The phone number of the subscriber.
The URL of the subscriber's avatar image.
The locale setting of the subscriber, indicating their preferred language or region.
An array of channel settings associated with the subscriber.
The provider identifier for the credentials
slack
, discord
, msteams
, mattermost
, ryver
, zulip
, grafana-on-call
, getstream
, rocket-chat
, whatsapp-business
, fcm
, apns
, expo
, one-signal
, pushpad
, push-webhook
, pusher-beams
Credentials payload for the specified provider
Webhook URL used by chat app integrations. The webhook should be obtained from the chat app provider.
Channel specification for Mattermost chat notifications.
Contains an array of the subscriber device tokens for a given provider. Used on Push integrations.
Alert UID for Grafana on-call webhook payload.
Title to be used with Grafana on-call webhook.
Image URL property for Grafana on-call webhook.
State property for Grafana on-call webhook.
Link to upstream details property for Grafana on-call webhook.
The unique identifier of the integration associated with this channel.
The integration identifier
An array of topics that the subscriber is subscribed to.
Indicates whether the subscriber is currently online.
The timestamp indicating when the subscriber was last online, in ISO 8601 format.
The version of the subscriber document.
Additional custom data for the subscriber
Timezone of the subscriber
Was this page helpful?
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.subscribers.list();
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
{
"page": 123,
"hasMore": true,
"pageSize": 123,
"data": [
{
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"subscriberId": "<string>",
"channels": [
{
"providerId": "slack",
"integrationIdentifier": "<string>",
"credentials": {
"webhookUrl": "https://example.com/webhook",
"channel": "general",
"deviceTokens": [
"token1",
"token2",
"token3"
],
"alertUid": "12345-abcde",
"title": "Critical Alert",
"imageUrl": "https://example.com/image.png",
"state": "resolved",
"externalUrl": "https://example.com/details"
},
"_integrationId": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"_organizationId": "<string>",
"_environmentId": "<string>",
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
}
]
}