docs/platform/inbox/configuration/data-object.mdx
The data object is a customizable key-value store available in the in-app step. You can use it to extend each Inbox component notification by embedding custom data. The data can then be used to personalize how messages appear in the Inbox component.
You define the data object inside an in-app step in your workflow on the Novu dashboard. Each entry is a key-value pair, referred to as a property. You can define up to 10 properties per in-app step. Each property can be:
{{subscriber.firstName}} or {{payload.issueId}}.The data object is available on the frontend as notification.data. You can use it inside the renderNotification function to customize how each notification is displayed.
import { Inbox } from '@novu/react';
function NovuDataObject() {
return (
<Inbox
applicationIdentifier="YOUR_APPLICATION_IDENTIFIER"
subscriber="YOUR_SUBSCRIBER_ID"
renderNotification={(notification) => (
<div>
<p>{notification.data?.firstName}</p>
<p>{notification.data?.emoji}</p>
</div>
)}
/>
);
}
export default NovuDataObject;
For TypeScript users, define a NotificationData interface to ensure type safety when accessing notification.data.
declare global {
interface NotificationData {
reactionType?: string;
entityId?: string;
userName?: string;
}
}
This allows TypeScript to infer the structure of notification.data, reducing errors when accessing properties.
You can use data object keys as filter for tabs. For more information, refer to Tabs.
import { Inbox } from '@novu/react';
export default function InboxWithFilters() {
const tabs = [
{
label: 'High Priority',
filter: {
data: { priority: 'high' },
},
},
{
label: 'User Activity',
filter: {
data: { type: 'login' },
},
},
];
return (
<Inbox
applicationIdentifier="YOUR_APPLICATION_IDENTIFIER"
subscriber="YOUR_SUBSCRIBER_ID"
tabs={tabs}
/>
);
}