This cookbook contains recipes and code samples demonstrating how to accomplish everyday tasks with Novu in your application. Each code example uses our libraries and SDKs.

Workflow, Feed, Messages & Notifications Flow in Novu

Fetch Subscriber Feed

A subscriber feed is a list of all In-App messages for a single subscriber. It’s a continuous stream of messages displayed in a list that subscribers can scroll through on the frontend via the Notification Center.

It is a dynamic list with seen and unseen capabilities. Multiple feeds can exist for a subscriber.

Subscriber Feed is very different from Activity Feed. The former is for In-App channels, while the latter is a list of every message and relevant metadata across all channels shown in your dashboard.

The code sample below fetches the list of all In-App messages sent to a specific subscriber:

Fetch All Feeds

In-App messages are grouped in Feeds. There can be one or multiple feeds.

The code sample below fetches all the feeds that have been created and exist in the In-App steps:

Delete a Message From a Feed

A message is a content sent to a single subscriber over a single channel. Some messages are simple, like SMS, while others have more features and capabilities, such as Email, Chat, In-App.

A single message can be deleted from a Feed. The code sample below shows how to do it:

Fetch all Messages Sent To All Subscribers

You can retrieve all messages sent to all subscribers. There are a couple of filters you can apply to fetch these messages.

  • channel: fetches all messages that were sent via a specific channel, e.g Email, Sms, Push, In-App
  • subscriberId: fetches all messages sent to a specific subscriber
  • transactionIds: fetches all messages via transaction ids.

Mark an In-App Message as Read/Seen

You can mark an In-App message as read/seen. Messages from other channels: Email, Push, Chat, Sms can’t be marked as read/seen.

Mark an In-App Message as Read/Unread/Seen/Unseen

You can mark an In-App message as read/unread/seen/unseen. Messages from other channels: Email, Push, Chat, Sms can’t be marked as read/unread/seen/unseen.

Mark all In-App Messages as Read/Unread/Seen/Unseen

You can mark all In-App messages as read/unread/seen/unseen.

Messages from other channels: Email, Push, Chat, Sms can’t be marked as read/unread/seen/unseen.

Send Slack Notifications

You can send notifications to Slack Channels via Novu like so:

Node.js
import {
  Novu,
  ChatProviderIdEnum
} from '@novu/node';

const novu = new Novu("<NOVU_API_KEY>");

// Identify Subscriber
await novu.subscribers.identify('<SUBSCRIBER_ID>', {
  firstName: 'newSubForSlackChat',
});

// Set credentials for the Subscriber
await novu.subscribers.setCredentials('<SUBSCRIBER_ID>', ChatProviderIdEnum.Slack, {
  webhookUrl: "<WEBHOOK_URL>",
});

// Trigger slack notification
await novu.trigger('slack', {
  to: {
    subscriberId: '<SUBSCRIBER_ID>'
  },
  payload: {
    chatMsg: '<INSERT_MESSAGE_CONTENT>'
  }
});

where chatMsg is a payload variable in the workflow editor.

Follow the full guide on how to send Slack notifications using Novu.