Using contexts for Inbox personalization
Learn how to use contexts in the Inbox component to filter and personalize notifications for your subscribers.
Contexts let you scope each <Inbox /> instance to a specific environment, tenant, or app within your product. When combined with workflow-level contexts, they ensure that each <Inbox /> displays only the notifications relevant to that specific context.
How context works in <Inbox/>
The <Inbox /> uses exact-match context filtering to determine which notifications to display. This means the context provided to the <Inbox /> must match all the key-value pairs of the context used when the workflow was triggered.
This creates predictable isolation and ensures notifications can't accidentally leak across boundaries. If the contexts do not match exactly, the notification will not be delivered to that Inbox session.
| Workflow Context | Inbox Context | Displayed? |
|---|---|---|
{ "tenant": "acme" } | { "tenant": "acme" } | ✅ Yes |
{ "tenant": "acme" } | { "tenant": "globex" } | ❌ No |
{ "tenant": "acme", "app": "dashboard" } | { "tenant": "acme" } | ❌ No |
{} | {} | ✅ Yes |
Creating context via <Inbox/>
If a new context is passed from the <Inbox /> that doesn’t already exist, Novu will automatically find or create it. This means you don’t have to manually set up contexts before using them, they are created just in time.
However, if a context already exists, its data won’t be updated automatically. This prevents unintentional overwrites of stored context data.
This is particularly useful for:
- Dynamic tenants or organizations: When users join or switch organizations.
- Feature-specific dashboards: Where each section of your app has its own notification scope.
You can view all automatically created contexts under the Contexts section of your Novu dashboard.
Applying context to the Inbox
You can filter the <Inbox /> notifications to a specific context, by passing a context prop to the <Inbox /> component.
This prop's value defines the filter for that session, and it will only request and show notifications that match this context.
When a workflow with these exact context is triggered, as seen below

Then, the notifications will be delivered to the <Inbox />.

How to secure your context
Because the context prop is set on the client-side, a malicious user could potentially tamper with it to view notifications from a different tenant.
To prevent this, you must validate the session using HMAC encryption. This ensures that the context data comes from your server and has not been altered.