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'
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
- toarray
- 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 data: data
3}
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
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 data: ["data"]
3}
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 data: data
3}
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
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
1{
2 data: true
3}
Get subscribers
Returns a list of subscribers, could paginated using the `page` and `limit` query parameter
Endpoint
Query parameters
- pagenumber (optional)
- limitnumber (optional)
Responses
- 200
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
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 data: data
3}
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 data: data
3}
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 data: data
3}
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 data: data
3}
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 data: data
3}
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 data: data
3}
Get subscriber preferences
Endpoint
Path parameters
- subscriberIdstring
Responses
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 data: ["data"]
3}
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 data: data
3}
Get in-app notification feed for a particular subscriber
Endpoint
Path parameters
- subscriberIdstring
Query parameters
- pagenumber (optional)
- limitnumber (optional)
- readboolean (optional)
- seenboolean (optional)
Responses
- 200
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
Get the unseen in-app notifications count for subscribers feed
Endpoint
Path parameters
- subscriberIdstring
Query parameters
- seenboolean
- limitnumber
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 data: data
3}
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 data: ["data"]
3}
Mark message action as seen
Endpoint
Path parameters
- messageIdstring
- typestring
- subscriberIdstring
Body parameters
- statusstring
Message action status
- payloadobject (optional)
Message action payload
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 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 status: "status",
11 payload: payload
12 }),
13});
14const data = await response.json();
15
1{
2 data: data
3}
Topic creation
Create a topic
Endpoint
Body parameters
- keystring
User defined custom key and provided by the user that will be an unique identifier for the Topic created.
- namestring
User defined custom name and provided by the user that will name the Topic created.
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics', {
4 method: 'POST',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 key: "key",
11 name: "name"
12 }),
13});
14const data = await response.json();
15
1{
2 data: data
3}
Filter topics
Returns a list of topics that can be paginated using the `page` query parameter and filtered by the topic key with the `key` query parameter
Endpoint
Query parameters
- pagenumber (optional)
Number of page for the pagination
- pageSizenumber (optional)
Size of page for the pagination
- keystring (optional)
Topic key
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 data: ["data"],
3 page: 0,
4 pageSize: 0,
5 totalCount: 0
6}
Subscribers addition
Add subscribers to a topic by key
Endpoint
Path parameters
- topicKeystring
Body parameters
- subscribersarray
List of subscriber identifiers that will be associated to the topic
Responses
- 200
- 204
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey/subscribers', {
4 method: 'POST',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 subscribers: ["subscribers"]
11 }),
12});
13const data = await response.json();
14
Check topic subscriber
Check if a subscriber belongs to a certain topic
Endpoint
Path parameters
- topicKeystring
- externalSubscriberIdstring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey/subscribers/:externalSubscriberId', {
4 method: 'GET',
5
6});
7const data = await response.json();
8
1{
2 _organizationId: "_organizationId",
3 _environmentId: "_environmentId",
4 _subscriberId: "_subscriberId",
5 _topicId: "_topicId",
6 topicKey: "topicKey",
7 externalSubscriberId: "externalSubscriberId"
8}
Subscribers removal
Remove subscribers from a topic
Endpoint
Path parameters
- topicKeystring
Body parameters
- subscribersarray
List of subscriber identifiers that will be removed to the topic
Responses
- 204
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey/subscribers/removal', {
4 method: 'POST',
5 headers: {
6 'Content-Type': 'application/json',
7 'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8 },
9 body: JSON.stringify({
10 subscribers: ["subscribers"]
11 }),
12});
13const data = await response.json();
14
Delete topic
Delete a topic by its topic key if it has no subscribers
Endpoint
Path parameters
- topicKeystring
Responses
- 204
The topic has been deleted correctly
- 404
The topic with the key provided does not exist in the database so it can not be deleted.
- 409
The topic you are trying to delete has subscribers assigned to it. Delete the subscribers before deleting the topic.
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey', {
4 method: 'DELETE',
5
6});
7const data = await response.json();
8
Get topic
Get a topic by its topic key
Endpoint
Path parameters
- topicKeystring
Responses
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey', {
4 method: 'GET',
5
6});
7const data = await response.json();
8