-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
📜 Description
When fetching notifications using the Novu React Native SDK, each notification item’s payload (or data body) is undefined. Because of this, I cannot access the custom data required for dynamic / custom deep linking in my app.
This makes it impossible to implement navigation logic based on the payload (e.g., screen, entityId, etc.) that is sent with the notification from Novu.
Environment:
-
React Native (Expo managed)
-
"expo": "54.0.23"
-
"react-native": "0.81.5"
-
-
Novu SDK:
- "@novu/react-native": "^3.10.1"
👟 Reproduction steps
- Set up Novu SaaS with a template that includes a JSON payload, for example:
{
"screen": "OrderDetails",
"orderId": "12345"
}- In a React Native / Expo app, initialize Novu:
import React from 'react';
import { NovuProvider } from '@novu/react-native';
export default function App() {
return (
<NovuProvider
applicationIdentifier="<YOUR_APP_ID>"
subscriberId="<YOUR_SUBSCRIBER_ID>"
>
<NotificationListScreen />
</NovuProvider>
);
}- Use the Novu hooks / methods to fetch notifications (example):
import React from 'react';
import { Text, View, FlatList } from 'react-native';
import { useNotifications } from '@novu/react-native';
export function NotificationListScreen() {
const { data, isLoading, error } = useNotifications();
if (isLoading) return <Text>Loading…</Text>;
if (error) return <Text>Error: {String(error)}</Text>;
return (
<FlatList
data={data?.notifications ?? []}
keyExtractor={(item) => item._id}
renderItem={({ item }) => (
<View>
<Text>Subject: {item?.subject}</Text>
<Text>Payload: {JSON.stringify(item?.payload)}</Text>
</View>
)}
/>
);
}-
Trigger a notification from Novu that includes the JSON payload in the template.
-
Observe the logged item.datafor each notification item.
👍 Expected behavior
-
Each notification item should expose the payload/body that was sent from Novu (e.g. a payload or data field).
-
The payload should contain the custom fields defined in the template (e.g. screen, orderId, etc.).
👎 Actual Behavior with Screenshots
-
item.payload (or equivalent field for the payload body) is undefined for every notification item.
-
Only basic information (like subject, content, etc.) is available.
Novu version
Novu SaaS
npm version
NA
node version
v22.14.0
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find a similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to submit PR?
None