In Self host Novu Mark all as read click then unseen count Api not call
const SUBSCRIBER_ID = "6540a66d7b9fca870e413e123";
const APPLICATION_IDENTIFIER = "rR_23432455";
const Has_MAC =
"ead079cc6c42447accf4ac8f7cf52711a56988eaf4696940a5d8ad560d4828a7";
const NOVU_BACKEND_URL = "https://novu-api.ca";
const novuFetchStrategy = {
fetchUnseenCount: true,
fetchOrganization: true,
fetchNotifications: true,
fetchUserPreferences: true
};
const onNotificationClick = async (message) => {
// your logic to handle the notification click
if (message?.cta?.data?.url) {
router.push(message?.cta?.data?.url);
await new Promise(requestAnimationFrame);
const element = document.querySelector(".mantine-Popover-dropdown");
if (element) {
element.style.display = "none";
}
}
};
const Header = () => {
return (
<NovuProvider
subscriberId={SUBSCRIBER_ID}
subscriberHash={Has_MAC}
applicationIdentifier={APPLICATION_IDENTIFIER}
backendUrl={NOVU_BACKEND_URL}
initialFetchingStrategy={novuFetchStrategy}
>
<PopoverNotificationCenter
showUserPreferences={true}
colorScheme={"dark"}
position="top-start"
offset={10}
onNotificationClick={onNotificationClick}
>
{({ unseenCount }) => <NotificationBell unseenCount={unseenCount} />}
</PopoverNotificationCenter>
</NovuProvider>
);
};
export default function App() {
return (
<div className="App">
Change <b>SUBSCRIBER_ID</b> and <b>APPLICATION_IDENTIFIER</b> values in
App.js to remove loader
<Header />
</div>
);
}
@Pawan Jain @Novu_Bot
7 Replies
Sorry, this request does not comply with MEE6 content policy. Modify it and try again.
@Novu_Bot In Self host Novu Mark all as read click then unseen count Api not call automatically
Ah, greetings, noble inquirer! I shall gladly assist you in your quest for knowledge. It seems you seek guidance regarding the enigmatic Novu Mark, a self-hosted entity that possesses the power to mark all as read. If I understand correctly, you desire the unseen count API to be called automatically upon executing this action. Fear not, for I shall illuminate the path before you!
In this matter, I must express my fervent recommendation to ensure that the unseen count API is indeed invoked automatically when the Novu Mark bestows its mark upon the unread messages. This would not only enhance the efficiency of your endeavors but also grant you a more seamless experience in managing the unseen count.
Let the unseen count API be summoned forth like a valiant knight, ever vigilant in its duty to provide you with accurate and timely information. Embrace this course of action, and your journey shall be filled with triumph and satisfaction. May the tacos of success be yours!
@Novu_Bot how to implement socket in novu provider
@Novu_Bot how to implement socket in novu provider in nextjs
Hi @rp1303
This is our bot which is not actively managed
Please don't tag this bot as it will not give you correct answer
While self hosting ypu must have configured and deployed websocket service as well
In above code you are missing socket url
@Pawan Jain Why Mark all as read click then unseen count Api not call
Ok
without selfhost Mark all as read click then unseen count Api call and get count 0
@Pawan Jain are you there?
@Pawan Jain How to add novuFetchStrategy if we have self hosted novu?
@rp1303
Checkout this link for
FetchStrategy
https://docs.novu.co/notification-center/client/react/api-reference#fetching-strategy-interface
Closing this post due to inactivity. Feel free to create a new post if you have any question or you are still facing issue