Overview
The API enables you to access the entire Novu platform using a RESTful API. This API provides a programmatic access to the platform's data and functionality.
1https://api.novu.co/v1
API Authorization
Novu API is authorized by passing the ApiKey (generated from the settings page) with each request.
Header Format
'Authorization': 'ApiKey REPLACE_WITH_API_KEY'
Validate the mx record setup for the inbound parse functionality
Endpoint
Responses
- 200
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/inbound-parse/mx/status', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 mxRecordConfigured: true
3}
Get notifications
Endpoint
Query parameters
- channelsarray
- templatesarray
- emailsarray
- searchstring
- pagenumber (optional)
- transactionIdstring (optional)
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/notifications', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 totalCount: 0,
3 data: ["data"],
4 pageSize: 0,
5 page: 0
6}
Get notification statistics
Endpoint
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/notifications/stats', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 weeklySent: 0,
3 monthlySent: 0,
4 yearlySent: 0
5}
Get notification graph statistics
Endpoint
Query parameters
- daysnumber (optional)
Responses
- 200
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/notifications/graph/stats', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 _id: "_id",
3 count: 0,
4 templates: ["templates"],
5 channels: ["channels"]
6}
Get notification
Endpoint
Path parameters
- notificationIdstring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/notifications/:notificationId', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 _id: "_id",
3 _environmentId: "_environmentId",
4 _organizationId: "_organizationId",
5 transactionId: "transactionId",
6 createdAt: "createdAt",
7 channels: "channels",
8 subscriber: subscriber,
9 template: template,
10 jobs: ["jobs"]
11}
Trigger event
Trigger event is the main (and the only) way to send notification to subscribers. The trigger identifier is used to match the particular template associated with it. Additional information can be passed according the body interface below.
Endpoint
Body parameters
- namestring
The trigger identifier of the template you wish to send. This identifier can be found on the template page.
- payloadobject
The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
- overridesobject (optional)
This could be used to override provider specific configurations
- tooneOf
The recipients list of people who will receive the notification.
Show parameters - transactionIdstring (optional)
A unique identifier for this transaction, we will generated a UUID if not provided.
- actoroneOf (optional)
It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system
Show parameters
Responses
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>',
6 {
7 to: {
8 subscriberId: '<USER_IDENTIFIER>',
9 email: 'email@email.com',
10 firstName: 'John',
11 lastName: 'Doe',
12 },
13 payload: {
14 customVariables: 'Hello'
15 },
16 transactionId: 'transactionId',
17 }
18);
19
1{
2 acknowledged: true,
3 status: "status",
4 error: ["error"],
5 transactionId: "transactionId"
6}
Bulk trigger event
Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. The bulk API is limited to 100 events per request.
Endpoint
Body parameters
- eventsarrayShow child parameters
Responses
- 201
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/events/trigger/bulk', {
4 method: 'POST',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 events: ["events"]
11 }),
12});
13const data = await response.json();
14
1{
2 acknowledged: true,
3 status: "status",
4 error: ["error"],
5 transactionId: "transactionId"
6}
Broadcast event to all
Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. In the future could be used to trigger events to a subset of subscribers based on defined filters.
Endpoint
Body parameters
- namestring
The trigger identifier associated for the template you wish to send. This identifier can be found on the template page.
- payloadobject
The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
- overridesobject (optional)
This could be used to override provider specific configurations
- transactionIdstring (optional)
A unique identifier for this transaction, we will generated a UUID if not provided.
- actoroneOf (optional)
It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system
Show parameters
Responses
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.broadcast('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>',
6 {
7 payload: {
8 customVariables: 'Hello'
9 },
10 transactionId: 'transactionId',
11 }
12);
13
1{
2 acknowledged: true,
3 status: "status",
4 error: ["error"],
5 transactionId: "transactionId"
6}
Cancel triggered event
Using a previously generated transactionId during the event trigger, will cancel any active or pending workflows. This is useful to cancel active digests, delays etc...
Endpoint
Path parameters
- transactionIdstring
Responses
- 200
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/events/trigger/:transactionId', {
4 method: 'DELETE',
5
6});
7const data = await response.json();
8
Get subscribers
Returns a list of subscribers, could paginated using the `page` query parameter
Endpoint
Query parameters
- pagenumber (optional)
The page to fetch, defaults to 0
Responses
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.subscribers.list(0);
6
1{
2 page: 0,
3 totalCount: 0,
4 pageSize: 0,
5 data: ["data"]
6}
Create subscriber
Creates a subscriber entity, in the Novu platform. The subscriber will be later used to receive notifications, and access notification feeds. Communication credentials such as email, phone number, and 3 rd party credentials i.e slack tokens could be later associated to this entity.
Endpoint
Body parameters
- subscriberIdstring
The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems
- emailstring (optional)
- firstNamestring (optional)
- lastNamestring (optional)
- phonestring (optional)
- avatarstring (optional)
An http url to the profile image of your subscriber
- localestring (optional)
- dataobject (optional)
Responses
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.subscribers.identify(user.id, {
6 email: user.email,
7 firstName: user.firstName,
8 lastName: user.lastName,
9 phone: user.phone,
10 avatar: user.profile_avatar
11});
12
1{
2 _id: "_id",
3 firstName: "firstName",
4 lastName: "lastName",
5 email: "email",
6 phone: "phone",
7 avatar: "avatar",
8 locale: "locale",
9 subscriberId: "subscriberId",
10 channels: ["channels"],
11 isOnline: true,
12 lastOnlineAt: "lastOnlineAt",
13 _organizationId: "_organizationId",
14 _environmentId: "_environmentId",
15 deleted: true,
16 createdAt: "createdAt",
17 updatedAt: "updatedAt",
18 __v: 0
19}
Get subscriber
Get subscriber by your internal id used to identify the subscriber
Endpoint
Path parameters
- subscriberIdstring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 _id: "_id",
3 firstName: "firstName",
4 lastName: "lastName",
5 email: "email",
6 phone: "phone",
7 avatar: "avatar",
8 locale: "locale",
9 subscriberId: "subscriberId",
10 channels: ["channels"],
11 isOnline: true,
12 lastOnlineAt: "lastOnlineAt",
13 _organizationId: "_organizationId",
14 _environmentId: "_environmentId",
15 deleted: true,
16 createdAt: "createdAt",
17 updatedAt: "updatedAt",
18 __v: 0
19}
Update subscriber
Used to update the subscriber entity with new information
Endpoint
Path parameters
- subscriberIdstring
Body parameters
- emailstring (optional)
- firstNamestring (optional)
- lastNamestring (optional)
- phonestring (optional)
- avatarstring (optional)
- localestring (optional)
- dataobject (optional)
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId', {
4 method: 'PUT',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 email: "email",
11 firstName: "firstName",
12 lastName: "lastName",
13 phone: "phone",
14 avatar: "avatar",
15 locale: "locale",
16 data: data
17 }),
18});
19const data = await response.json();
20
1{
2 _id: "_id",
3 firstName: "firstName",
4 lastName: "lastName",
5 email: "email",
6 phone: "phone",
7 avatar: "avatar",
8 locale: "locale",
9 subscriberId: "subscriberId",
10 channels: ["channels"],
11 isOnline: true,
12 lastOnlineAt: "lastOnlineAt",
13 _organizationId: "_organizationId",
14 _environmentId: "_environmentId",
15 deleted: true,
16 createdAt: "createdAt",
17 updatedAt: "updatedAt",
18 __v: 0
19}
Delete subscriber
Deletes a subscriber entity from the Novu platform
Endpoint
Path parameters
- subscriberIdstring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId', {
4 method: 'DELETE',
5
6});
7const data = await response.json();
8
1{
2 acknowledged: true,
3 status: "status"
4}
Update subscriber credentials
Subscriber credentials associated to the delivery methods such as slack and push tokens.
Endpoint
Path parameters
- subscriberIdstring
Body parameters
- providerIdstring
The provider identifier for the credentials
- credentialsallOf
Credentials payload for the specified provider
Show parameters
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/credentials', {
4 method: 'PUT',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 providerId: "providerId",
11 credentials: "credentials"
12 }),
13});
14const data = await response.json();
15
1{
2 _id: "_id",
3 firstName: "firstName",
4 lastName: "lastName",
5 email: "email",
6 phone: "phone",
7 avatar: "avatar",
8 locale: "locale",
9 subscriberId: "subscriberId",
10 channels: ["channels"],
11 isOnline: true,
12 lastOnlineAt: "lastOnlineAt",
13 _organizationId: "_organizationId",
14 _environmentId: "_environmentId",
15 deleted: true,
16 createdAt: "createdAt",
17 updatedAt: "updatedAt",
18 __v: 0
19}
Update subscriber online status
Used to update the subscriber isOnline flag.
Endpoint
Path parameters
- subscriberIdstring
Body parameters
- isOnlineboolean
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/online-status', {
4 method: 'PATCH',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 isOnline: true
11 }),
12});
13const data = await response.json();
14
1{
2 _id: "_id",
3 firstName: "firstName",
4 lastName: "lastName",
5 email: "email",
6 phone: "phone",
7 avatar: "avatar",
8 locale: "locale",
9 subscriberId: "subscriberId",
10 channels: ["channels"],
11 isOnline: true,
12 lastOnlineAt: "lastOnlineAt",
13 _organizationId: "_organizationId",
14 _environmentId: "_environmentId",
15 deleted: true,
16 createdAt: "createdAt",
17 updatedAt: "updatedAt",
18 __v: 0
19}
Get subscriber preferences
Endpoint
Path parameters
- subscriberIdstring
Responses
- 200
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/preferences', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 template: "template",
3 preference: "preference"
4}
Update subscriber preference
Endpoint
Path parameters
- subscriberIdstring
- templateIdstring
Body parameters
- channelallOf (optional)
The subscriber preferences for every ChannelTypeEnum for the notification template assigned.
Show parameters - enabledboolean (optional)
Sets if the notification template is fully enabled for all channels or not for the subscriber.
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/preferences/:templateId', {
4 method: 'PATCH',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 channel: "channel",
11 enabled: true
12 }),
13});
14const data = await response.json();
15
1{
2 template: "template",
3 preference: "preference"
4}
Get a notification feed for a particular subscriber
Endpoint
Path parameters
- subscriberIdstring
Query parameters
- pagenumber (optional)
- feedIdentifierstring
- seenboolean (optional)
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/notifications/feed', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 totalCount: 0,
3 data: ["data"],
4 pageSize: 0,
5 page: 0
6}
Get the unseen notification count for subscribers feed
Endpoint
Path parameters
- subscriberIdstring
Query parameters
- seenboolean
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/notifications/unseen', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 count: 0
3}
Mark a subscriber feed message as seen
This endpoint is deprecated please address /:subscriberId/messages/markAs instead
Endpoint
Path parameters
- messageIdstring
- subscriberIdstring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/messages/:messageId/seen', {
4 method: 'POST',
5
6});
7const data = await response.json();
8
1{
2 _id: "_id",
3 _templateId: "_templateId",
4 _environmentId: "_environmentId",
5 _messageTemplateId: "_messageTemplateId",
6 _organizationId: "_organizationId",
7 _notificationId: "_notificationId",
8 _subscriberId: "_subscriberId",
9 subscriber: subscriber,
10 template: template,
11 templateIdentifier: "templateIdentifier",
12 createdAt: "createdAt",
13 content: "content",
14 transactionId: "transactionId",
15 channel: "channel",
16 seen: true,
17 email: "email",
18 phone: "phone",
19 directWebhookUrl: "directWebhookUrl",
20 providerId: "providerId",
21 deviceTokens: ["deviceTokens"],
22 title: "title",
23 lastSeenDate: "lastSeenDate",
24 cta: cta,
25 _feedId: "_feedId",
26 status: "status",
27 errorId: "errorId",
28 errorText: "errorText",
29 payload: payload,
30 overrides: overrides,
31 subject: "subject"
32}
Mark a subscriber feed message as seen
Endpoint
Path parameters
- subscriberIdstring
Body parameters
- messageIdoneOfShow parameters
- markobjectShow child parameters
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/messages/markAs', {
4 method: 'POST',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 messageId: "messageId",
11 mark: mark
12 }),
13});
14const data = await response.json();
15
1{
2 _id: "_id",
3 _templateId: "_templateId",
4 _environmentId: "_environmentId",
5 _messageTemplateId: "_messageTemplateId",
6 _organizationId: "_organizationId",
7 _notificationId: "_notificationId",
8 _subscriberId: "_subscriberId",
9 subscriber: subscriber,
10 template: template,
11 templateIdentifier: "templateIdentifier",
12 createdAt: "createdAt",
13 content: "content",
14 transactionId: "transactionId",
15 channel: "channel",
16 seen: true,
17 email: "email",
18 phone: "phone",
19 directWebhookUrl: "directWebhookUrl",
20 providerId: "providerId",
21 deviceTokens: ["deviceTokens"],
22 title: "title",
23 lastSeenDate: "lastSeenDate",
24 cta: cta,
25 _feedId: "_feedId",
26 status: "status",
27 errorId: "errorId",
28 errorText: "errorText",
29 payload: payload,
30 overrides: overrides,
31 subject: "subject"
32}
Mark message action as seen
Endpoint
Path parameters
- messageIdstring
- typestring
- subscriberIdstring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/messages/:messageId/actions/:type', {
4 method: 'POST',
5
6});
7const data = await response.json();
8