<Subscription /> Quickstart
Learn how to integrate and render the Subscription component in your React app to manage user preferences.
@novu/nextjs, @novu/react and @novu/js packages.This quickstart shows how to render the subscription UI in your app. The subscription UI lets users subscribe to topics, define conditions, and manage how they receive notifications.
The <Subscription /> component is designed to work within an existing Novu environment and uses the same provider and session context as the Inbox component.
Create a topic
Subscriptions are managed at the topic level. You can create a topic manually in the Novu Dashboard or via the API.
However, you don't have to create it beforehand. If the topic key you provide to the component does not exist, Novu will automatically create it for you.
Topics can represent any category of notifications. To learn more, see the Topics documentation.
Install @novu/nextjs
Ensure you have the latest version of the @novu/nextjs package installed in your project.
Initialize the Novu client
Wrap your app or the specific section where the subscription component would live with the <NovuProvider>. Configure the provider with your applicationIdentifier and the current user's subscriberId.
Add the component
Place the <Subscription /> component inside the provider. You must pass the topicKey.
The identifier prop is optional, you only need to provide it if you intend to manage multiple distinct subscriptions for the same topic.