Skip to content

Commit b36cd0e

Browse files
Merge pull request #971 from novuhq/preferences-page
Preferences page
2 parents 46dd776 + e265126 commit b36cd0e

File tree

4 files changed

+104
-1
lines changed

4 files changed

+104
-1
lines changed

content/docs/platform/subscribers-and-topics/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"manage-topics",
88
"trigger-workflows-to-topics"
99
]
10-
}
10+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: 'Subscribers Preferences'
3+
description: "Learn how to manage subscribers preferences from the Novu dashboard and using the Novu API"
4+
icon: 'Settings2'
5+
---
6+
7+
Novu provides a flexible system with multiple levels of preferences that dictate how and where a subscriber receives messages. These settings influence both the delivery channels and the types of notifications a subscriber will receive.
8+
9+
Subscribers can define how they want to receive notifications. These preferences influence both the delivery channels and the types of notifications a subscriber will receive.
10+
11+
Preferences can be managed in three ways:
12+
13+
- By the subscriber, using the [Inbox UI](/platform/inbox/configuration/preferences).
14+
- By the organization owner, using the dashboard.
15+
- By developers, programmatically through the API.
16+
17+
Novu supports both global preferences and workflow-specific preferences for each subscriber. However, you can a subscriber preferences from the Novu dashboard.
18+
19+
## Global preferences
20+
21+
Global preferences act as a default "on/off" switch for a specific channel across all workflows. A subscriber can use this setting vai the Inbox component to unsubscribe from a channel like SMS or email entirely.
22+
23+
For example, if a subscriber disables a channel globally, that channel will also be disabled for all workflows that use that channel, and vice versa, unless they override it on the workflow level.
24+
25+
### Manage global preferences via dashboard
26+
27+
1. Log into the Novu dashboard.
28+
2. From the **Subscribers** page, click on a subscriber's profile.
29+
3. Navigate to the **Preferences** tab.
30+
4. Under the **Global Preferences** section, you can enable or disable channels.
31+
32+
![Subscriber global preferences](/images/manage-subscribers/subscriber-global-preferences.gif)
33+
34+
## Workflow preferences
35+
36+
Workflow preferences provide a more precise control, letting subscribers customize their channel choices for specific workflows.
37+
38+
For example, a subscriber can choose to only enable in-app notifications for a particular workflow. This preference will be honored while their global settings remain intact.
39+
40+
<Callout>You can mark a workflow as critical in the workflow settings. This ensures the workflow will not appear in the subscriber's preference settings, and they will always receive notifications from it.</Callout>
41+
42+
## Managing preferences in the dashboard
43+
44+
1. Log into the Novu dashboard.
45+
2. From the **Subscribers** page, click on a subscriber's profile and go to their Preferences tab.
46+
3. In the **Workflow Preferences** section, you will see a list of all workflows the subscriber is associated with.
47+
4. For each workflow, you can toggle individual channel preferences on or off.
48+
49+
![Subscriber preferences](/images/manage-subscribers/subscriber-workflow-preferences.gif)
50+
51+
## Managing preferences via API
52+
53+
Developers can use the Novu API to manage a subscriber's preferences. This is useful for building custom preference centers within your application or for automated management based on user behavior.
54+
55+
### Retrieve subscriber preferences
56+
57+
To inspect a subscriber's current preferences, including their global settings and all workflow-specific overrides, you can retrieve their preferences via the API using the `list` method.
58+
59+
```ts
60+
import { Novu } from "@novu/api";
61+
62+
const novu = new Novu({
63+
secretKey: "YOUR_SECRET_KEY_HERE",
64+
});
65+
66+
async function run() {
67+
const result = await novu.subscribers.preferences.list("<subscriberId>");
68+
console.log(result);
69+
}
70+
71+
run();
72+
```
73+
74+
For full request and response schemas, see the [Retrieve Subscriber Preferences](/api-reference/subscribers/retrieve-subscriber-preferences) endpoint.
75+
76+
### Update subscriber preferences
77+
78+
You can use the API to update a subscriber's preferences. You can update global channel preferences or specific workflow preferences using the same endpoint.
79+
80+
```typescript
81+
import { Novu } from "@novu/api";
82+
83+
const novu = new Novu({
84+
secretKey: "YOUR_SECRET_KEY_HERE",
85+
});
86+
87+
async function run() {
88+
const result = await novu.subscribers.preferences.update(
89+
{
90+
channels: {
91+
email: { enabled: false }, // disable globally
92+
},
93+
},
94+
"<subscriberId>"
95+
);
96+
97+
console.log(result);
98+
}
99+
100+
run();
101+
```
102+
103+
For full request and response schemas, see the [Update Subscriber Preferences](/api-reference/subscribers/update-subscriber-preferences) endpoint.
15.1 MB
Loading
20.2 MB
Loading

0 commit comments

Comments
 (0)