Preferences overview
Learn how to implement notification preferences in Knock.
Preferences enable your users to opt-out of the notifications you send using Knock.
How preferences work
#A user has a PreferenceSet. A PreferenceSet is a JSON object that tells Knock which channels, categories, and/or workflows a user has opted out of receiving.
When Knock runs a workflow for a user, we evaluate their PreferenceSet. A message will not send if the user has opted out of receiving it.
A preference set is built using four keys: categories, channels, channel_types, workflows. These keys resolve to boolean values to determine if a user has opted out of receiving a notification.
A recipient's default preference set also has a commercial_subscribed key which determines if the recipient should receive notifications sent by commercial workflows or broadcasts. Read more about commercial unsubscribe here.
A few examples:
Channels vs. channel types
#Channel preferences provide more granular control than channel types by allowing you to specify preferences for individual channels rather than entire channel types.
- Channel type preferences (
channel_types) control broad categories likeemail,sms, orpush - Channel preferences (
channels) control specific channel instances using their UUID identifiers
Channel preferences always take precedence over channel type preferences because they are more specific. See preference evaluation rules below for more information.
You can combine these keys to create preference grids like the one in the image below:
The PreferenceSet above models this preference grid in your application:

Environment-level default preferences
#You can set an environment-level default PreferenceSet in the Knock dashboard that applies to all recipients in an environment. When Knock evaluates preferences for a recipient who has not set any preferences of their own, the environment default serves as the baseline. This is useful when you want to establish a baseline that differs from Knock's default of opting all recipients in to all notifications.
The environment-level default is always the lowest priority in the merge hierarchy. Any preferences set at the recipient or tenant level will take precedence over it.
To set up an environment-level default preference set, see Create a default preference set.
Merging preferences
#When a default PreferenceSet exists for an environment or tenant, Knock will merge all applicable preferences for a recipient when evaluating whether or not to send a notification. Any preferences set at the recipient level will take precedence in the merge, according to the hierarchy outlined below.
Merge hierarchy
#The following hierarchies are used when merging preferences.
For more information on how you can override these hierarchies, see the frequently asked questions section below.
Preference evaluation rules
#When a workflow is triggered, Knock will evaluate the preferences for each recipient of the workflow and send notifications for each channel step in the workflow based on that evaluation. There are some important rules and caveats to consider:
Going live with preferences
#Once you've configured your preference model, you need a way for users to manage their preferences. Knock offers two approaches:
- Hosted preference center. Knock hosts and renders a preference page for each user, accessible via a signed URL. You configure rows, labels, and branding in the dashboard - no code required. Supports the user's
defaultpreference set only. See hosted preference center for more information. - Custom preference center. You build the UI and embed it in your product, using Knock's preferences API to read and write preference values. This gives you full control over layout, UX, and which preferences you surface—including per-tenant and object preferences. You can optionally use the dashboard-managed configuration to drive your row definitions without hardcoding them. See custom preference center for more information.
Bulk set user preferences
#You can update the preferences of up to 1000 users in a single batch by using the users.bulkSetPreferences method. This executes an asynchronous job which will overwrite any existing preferences for the users provided. You can track the progress of the BulkOperation returned via the bulk operation API.
Advanced concepts
#- Per-tenant preferences. In multi-tenant B2B applications, an advanced use case is customer admins who want to set the tenant-level default
PreferenceSetfor new users within their tenant. - Object preferences. You can set preferences for object recipients, just as you can for users.
- Preference conditions. You can build advanced conditions and store them on Knock’s preference model to power use cases such as per-resource muting (example: mute notifications about this task) or threshold alerts (example: only notify me if my account balance is below $5).
- Merge strategy. It's possible to configure the merge strategy on specific preferences within a
PreferenceSet. This allows you to override the default merge hierarchy when preferences are evaluated. See the frequently asked questions section below for more details and use cases. - Workflow overrides. If you need to override a recipient's notification preferences to send notifications like a password reset email, you can override the preferences model. To do this, go to your workflow, click "Manage workflow," and enable "Override recipient preferences." You will need to commit this change for it to take effect. When enabled, the workflow will send to all of its channels, regardless of the recipient's preferences.
- Commercial unsubscribe. You can configure 1-click unsubscribe links to help users opt-out of commercial or promotional notifications and comply with CAN-SPAM requirements.







