useNovu
API Reference
Subscribers
- GETGet subscribers
- POSTCreate subscriber
- POSTBulk create subscribers
- GETGet subscriber
- PUTUpdate subscriber
- DELDelete subscriber
- PUTUpdate subscriber credentials
- DELDelete subscriber credentials by providerId
- PATCHUpdate subscriber online status
- GETGet subscriber preferences
- GETGet subscriber global preferences
- PATCHUpdate subscriber preference
- PATCHUpdate subscriber global preferences
- GETGet in-app notification feed for a particular subscriber
- GETGet the unseen in-app notifications count for subscribers feed
- POSTMark a subscriber feed message as seen
- POSTMarks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
- POSTMark message action as seen
- GETHandle providers oauth redirect
- GETHandle chat oauth
Topics
Notification
Workflows
Workflow Overrides
Workflow groups
Integrations
Layouts
Execution Details
Organizations
useNovu
The useNovu
hook is used to obtain the Novu instance, which allows you to interact with the headless SDK interface.
The hook returns the Novu class instance with multiple methods to interact with the Novu API.
Example usage
The below example demonstrates how to use the useNovu
hook to listen for new notifications and show a toast notification.
import { useNovu } from '@novu/react/hooks';
const NotificationToast = () => {
const novu = useNovu();
useEffect(() => {
const listener = ({ result: notification }) => {
// Show a toast notification
};
novu.on('notifications.notification_received', listener);
return () => {
novu.off('notifications.notification_received', listener);
};
}, [novu]);
return null;
};
Was this page helpful?
On this page