Skip to content

Update content for inbox headless mode#1002

Merged
Aviatorscode2 merged 13 commits intomainfrom
MRK-1113
Nov 5, 2025
Merged

Update content for inbox headless mode#1002
Aviatorscode2 merged 13 commits intomainfrom
MRK-1113

Conversation

@Aviatorscode2
Copy link
Contributor

@Aviatorscode2 Aviatorscode2 commented Nov 4, 2025

Summary by CodeRabbit

  • Documentation
    • Rewrote headless inbox docs to use the React provider and hook-driven patterns; updated installation guidance to the React package.
    • Added copy-ready examples for rendering notification lists, per-item actions (mark-as-read, archive), loading/error states, and real-time counts.
    • Documented hooks for subscribing to live events, manual event handling, and proper listener cleanup.

@Aviatorscode2 Aviatorscode2 requested a review from scopsy November 4, 2025 14:55
@linear
Copy link

linear bot commented Nov 4, 2025

@netlify
Copy link

netlify bot commented Nov 4, 2025

Deploy Preview for docs-novu ready!

Name Link
🔨 Latest commit 4254363
🔍 Latest deploy log https://app.netlify.com/projects/docs-novu/deploys/690bcad3c4feb8000830d0d8
😎 Deploy Preview https://deploy-preview-1002--docs-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Rewrites the headless Inbox documentation to use the React package @novu/react, replacing imperative @novu/js examples with NovuProvider and React hooks (useNotifications, useCounts, useNovu) for data fetching, real-time subscriptions, and per-item actions.

Changes

Cohort / File(s) Summary
Documentation: Headless Inbox — React rewrite
content/docs/platform/inbox/headless-mode.mdx
Replaced @novu/js imperative examples with @novu/react provider-based initialization and hooks. Added NovuProvider, useNotifications, useCounts, useNovu usage examples; updated installation to @novu/react; added component patterns (NotificationsList, BellButton, NotificationItem) demonstrating fetching, actions (mark-as-read, archive), real-time subscriptions and cleanup.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant Provider as NovuProvider
  participant Component as UI Components
  participant Hooks as useNotifications / useCounts / useNovu
  participant Backend as Novu Backend

  rect rgba(220,235,255,0.6)
    App->>Provider: wrap app (applicationId / subscriberId)
    Component->>Hooks: mount -> call hooks
    Hooks->>Backend: fetch notifications & subscribe realtime
    Backend-->>Hooks: push events (notification_received, counts_changed)
    Hooks-->>Component: update state & expose actions (markAsRead, archive)
    Component->>Hooks: invoke action -> Hooks -> Backend (API call)
    Hooks-->>Backend: subscribe/unsubscribe for realtime events
  end

  note right of Hooks `#f3f4f6`: Hooks perform cleanup on unmount (novu.off / unsubscribe)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Areas to inspect:
    • Hook names/signatures and returned shape for useNotifications, useCounts, useNovu
    • NovuProvider props and context provisioning
    • Real-time subscribe/unsubscribe behavior (novu.on / novu.off) and component cleanup
    • Per-item action implementations (mark-as-read, archive) and UI state synchronization

Possibly related PRs

Suggested reviewers

  • jainpawan21
  • DianaHackmamba

Poem

🐇 In burrows bright I tap and hop,
Provider snug, no more setup flop,
Hooks fetch bells and counts that sing,
Mark and archive — tiny wings take wing,
Carrots, code, and a joyful ping. 🥕🔔

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating documentation content for the headless mode inbox feature, transitioning from JavaScript SDK to React-centric hooks.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch MRK-1113

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7f0cc5 and 4254363.

📒 Files selected for processing (1)
  • content/docs/platform/inbox/headless-mode.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:48-53
Timestamp: 2025-08-09T13:28:47.834Z
Learning: In the novu/react-native and novu/react packages, the NovuProvider component uses the prop name `subscriber` (not `subscriberId`) to pass the subscriber identifier. This is consistent across all documentation examples and the actual implementation.
📚 Learning: 2025-08-09T13:28:47.834Z
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:48-53
Timestamp: 2025-08-09T13:28:47.834Z
Learning: In the novu/react-native and novu/react packages, the NovuProvider component uses the prop name `subscriber` (not `subscriberId`) to pass the subscriber identifier. This is consistent across all documentation examples and the actual implementation.

Applied to files:

  • content/docs/platform/inbox/headless-mode.mdx
📚 Learning: 2025-08-10T17:11:58.975Z
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:51-53
Timestamp: 2025-08-10T17:11:58.975Z
Learning: In the Novu React Native SDK documentation, when updating from `backendUrl` to `apiUrl`, the EU API endpoint is documented as `https://eu.api.novu.co` without the `/v1` path segment, even though the REST API documentation may specify the `/v1` path. The SDK and REST API may have different URL requirements.

Applied to files:

  • content/docs/platform/inbox/headless-mode.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Lint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 061b42c and 6e7bb96.

📒 Files selected for processing (1)
  • content/docs/platform/inbox/headless-mode.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:48-53
Timestamp: 2025-08-09T13:28:47.834Z
Learning: In the novu/react-native and novu/react packages, the NovuProvider component uses the prop name `subscriber` (not `subscriberId`) to pass the subscriber identifier. This is consistent across all documentation examples and the actual implementation.
📚 Learning: 2025-08-09T13:28:47.834Z
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:48-53
Timestamp: 2025-08-09T13:28:47.834Z
Learning: In the novu/react-native and novu/react packages, the NovuProvider component uses the prop name `subscriber` (not `subscriberId`) to pass the subscriber identifier. This is consistent across all documentation examples and the actual implementation.

Applied to files:

  • content/docs/platform/inbox/headless-mode.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build and Lint
  • GitHub Check: Redirect rules - docs-novu
  • GitHub Check: Header rules - docs-novu
  • GitHub Check: Pages changed - docs-novu
🔇 Additional comments (5)
content/docs/platform/inbox/headless-mode.mdx (5)

26-39: NovuProvider implementation looks correct.

The prop name is correctly subscriber (not subscriberId), which aligns with the actual Novu React SDK implementation. Based on learnings from prior reviews, this is the correct pattern.


45-67: Notification fetching example is well-structured.

The useNotifications example properly handles loading and error states, includes pagination setup (though not actively demonstrated), and uses safe optional chaining. The rendering logic is clear and practical.


73-94: Unread count badge pattern is practical.

The useCounts example with filter configuration and fallback to ?? 0 demonstrates defensive programming. The badge rendering uses appropriate conditional logic.


102-148: Notification actions implementation is comprehensive.

The NotificationItem component demonstrates proper error handling in async operations (lines 112-113, 120-121), disables buttons based on notification state, and shows both common actions (read, archive). Type import using import type is correctly applied.


156-190: Event listener example demonstrates proper cleanup.

The event names notifications.notification_received and notifications.unread_count_changed are supported by the Novu React SDK. The NotificationListener component correctly subscribes to events on mount (lines 178-179) and properly unsubscribes in the cleanup function (lines 182-185), preventing memory leaks. The event naming convention used is consistent with Novu's standard.

Aviatorscode2 and others added 2 commits November 4, 2025 17:50
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e7bb96 and 0c3e0d8.

📒 Files selected for processing (1)
  • content/docs/platform/inbox/headless-mode.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:48-53
Timestamp: 2025-08-09T13:28:47.834Z
Learning: In the novu/react-native and novu/react packages, the NovuProvider component uses the prop name `subscriber` (not `subscriberId`) to pass the subscriber identifier. This is consistent across all documentation examples and the actual implementation.
📚 Learning: 2025-08-09T13:28:47.834Z
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:48-53
Timestamp: 2025-08-09T13:28:47.834Z
Learning: In the novu/react-native and novu/react packages, the NovuProvider component uses the prop name `subscriber` (not `subscriberId`) to pass the subscriber identifier. This is consistent across all documentation examples and the actual implementation.

Applied to files:

  • content/docs/platform/inbox/headless-mode.mdx
📚 Learning: 2025-08-10T17:11:58.975Z
Learnt from: jackall3n
Repo: novuhq/docs PR: 929
File: content/docs/platform/sdks/react-native/hooks/novu-provider.mdx:51-53
Timestamp: 2025-08-10T17:11:58.975Z
Learning: In the Novu React Native SDK documentation, when updating from `backendUrl` to `apiUrl`, the EU API endpoint is documented as `https://eu.api.novu.co` without the `/v1` path segment, even though the REST API documentation may specify the `/v1` path. The SDK and REST API may have different URL requirements.

Applied to files:

  • content/docs/platform/inbox/headless-mode.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Lint
🔇 Additional comments (5)
content/docs/platform/inbox/headless-mode.mdx (5)

1-10: Documentation rewrite looks comprehensive and well-structured.

The shift from generic JavaScript SDK narrative to React-focused hooks (NovuProvider, useNotifications, useCounts, useNovu) is clear and practical. Code examples are concrete with proper error handling and state management. All pending verification items relate to confirming exact API method names, event names, and type properties match the actual @novu/react implementation.

The shell scripts above will confirm all API details are accurate. This ensures the documentation matches the current SDK implementation.


77-81: Filter syntax and property names are correct.

The code at lines 77-81 uses the correct useCounts filter syntax. The filters parameter accepts NotificationFilter[] as documented, and read: false is a valid filter property shown in the official React SDK examples. The implementation matches the documented API exactly.


177-180: Event names verified as correct.

The @novu/react v3.x SDK emits both notifications.notification_received and notifications.unread_count_changed events, matching the implementation at lines 178–179. The event names and subscription pattern are consistent with SDK documentation.


130-145: No issues found—Notification type properly supports these properties.

The Notification type from @novu/react includes isRead and isArchived boolean properties. The code at lines 133 and 140 correctly uses these properties to disable buttons, consistent with official documentation and usage patterns across other parts of the codebase.


31-34: Code is correct—no issues found with NovuProvider props.

The subscriber prop is correct per retrieved learnings and multiple examples across the documentation repository (e.g., content/docs/platform/sdks/react/hooks/novu-provider.mdx). The applicationIdentifier is confirmed as a valid required prop for initializing NovuProvider.

Aviatorscode2 and others added 7 commits November 4, 2025 20:11
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Co-authored-by: DianaHackmamba <diana@hackmamba.io>
Copy link
Contributor

@DianaHackmamba DianaHackmamba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor things, then g2g.

@Aviatorscode2 Aviatorscode2 merged commit 91aa00c into main Nov 5, 2025
6 checks passed
@Aviatorscode2 Aviatorscode2 deleted the MRK-1113 branch November 5, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants