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
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:
Copy
Ask AI
const { data: inAppMessages } = await novu.subscribers.getNotificationsFeed('subscriberId', { page: 0, limit: 10, // it is of type string. By default all feeds messages are fetched feedIdentifier: 'Marketing', // seen and read filter of type boolean seen: true, read: true});
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:
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:
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.
Copy
Ask AI
import { MarkMessagesAsEnum } from "@novu/node"const { data: markAllInAppMessages } = await novu.subscribers.markAllMessagesAs( 'subscriberId', // can be filtered with feed identifiers feedIdentifier: ['Marketing', 'Product'] // MarkMessageAsEnum.READ => It will mark all messages as read // MarkMessageAsEnum.SEEN => It will mark all messages as seen // MarkMessageAsEnum.UNREAD => It will mark all messages as unread // MarkMessageAsEnum.UNSEEN => It will mark all messages as unseen markAs: MarkMessageAsEnum.Read);