Use the headless version of the notification center
Creating workflows is simple
blank workflow
from the dropdown:
Select **'Blank Workflow'** from the dropdown
Workflow editor allows you to create and edit workflows
In-App
channel.
The headless demo workflow that we'll be using
description
, which will
contain the text that will be entered from the front end. Here’s the in-app
node for your reference:The in-app node can be customized as per the need
update
button on the top right. It’ll automatically create a trigger code that you can use in your app. To get it, click on the get snippet
button on the top right and copy it:
Click on the `get snippet` button on the top right and copy it
applicationIdentifier
: You can find this from the settings
menu in the Novu web dashboard.subscriberID
: In most real-world apps, you’ll get this from a database. It is used to uniquely identify the entity to whom a notification will be delivered. In our case, we’re assuming the subscriberID
to be 12345
.<NOVU_SECRET_KEY>
value with the authentic key from the API Key section of your Novu Dashboard.fetchNotifications
function inside a useEffect because we want the effect to run whenever the fetchNotifications
executes. Here’s the fetchNotifications
function for reference:
fetchNotifications
to optimize performance and passed pageNum
in a dependency array so that it reruns when the page number changes.
markNotificationsAsRead
, deleteNotification
, and markAllMessagesAsRead
. They are as follows:
appBar
component which includes a bell icon, which can show notifications in a modal when clicked. The modal is displayed when showModal is true, and the modal can be closed by clicking outside of it. The component interacts with the notification-related functionalities provided by the useNotification hook:
NotificationModal
which is what gets displayed when the user clicks on the bell icon.
NotificationModal
component is as follows:
The headless app in action