-
Notifications
You must be signed in to change notification settings - Fork 5
feat: 1-click unsubscribe docs #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,69 @@ | ||||||
--- | ||||||
title: "Commercial Unsubscribe" | ||||||
description: "Learn how to manage commercial email unsubscribe functionality in Knock." | ||||||
tags: ["preferences", "unsubscribe", "commercial", "broadcasts", "workflows"] | ||||||
section: Preferences | ||||||
--- | ||||||
|
||||||
Knock provides built-in support for commercial email unsubscribe functionality, allowing recipients to opt out of promotional or commercial messages with a single click. | ||||||
|
||||||
## How commercial unsubscribe works | ||||||
|
||||||
When you mark a workflow or broadcast as commercial, Knock automatically handles the necessary unsubscribe functionality: | ||||||
|
||||||
1. Adds required unsubscribe headers to all emails sent through that workflow or broadcast. | ||||||
1. Provides an unsubscribe URL variable that can be included in your email templates. | ||||||
1. Manages recipient opt-outs during preference set evaluation. | ||||||
|
||||||
## Configuring commercial workflows | ||||||
|
||||||
To enable commercial unsubscribe functionality for a workflow or broadcast: | ||||||
|
||||||
1. Navigate to the workflow or broadcast. | ||||||
1. For a workflow, click "Manage workflow." For a broadcast, click "Edit details." | ||||||
1. Toggle "Commercial." | ||||||
1. Save your changes. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this setting exist outside of commit model, or should we call that out too? |
||||||
|
||||||
Once enabled, Knock will automatically include the necessary unsubscribe headers in all emails sent through that workflow. | ||||||
|
||||||
## Adding unsubscribe links to emails | ||||||
|
||||||
### Using footer links | ||||||
|
||||||
When configuring an email layout using the visual editor, you can toggle the "Include commercial unsubscribe link" input to include the unsubscribe link. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be helpful to include a screenshot here? |
||||||
|
||||||
### Using the code editor | ||||||
|
||||||
You can add an unsubscribe link to your email layouts or templates using the built-in variable: | ||||||
|
||||||
```liquid title="Show unsubscribe link" | ||||||
<a href="{{vars.commercial_unsubscribe_url}}">Unsubscribe</a> | ||||||
``` | ||||||
|
||||||
You can conditionally include the link by checking if the variable is present: | ||||||
|
||||||
```liquid title="Show unsubscribe link only for commercial messages" | ||||||
{% if vars.commercial_unsubscribe_url %} | ||||||
<a href="{{vars.commercial_unsubscribe_url}}">Unsubscribe</a> | ||||||
{% endif %} | ||||||
``` | ||||||
|
||||||
## Configuring the confirmation page | ||||||
|
||||||
When a user unsubscribes by clicking the unsubscribe link, Knock displays a confirmation page showing they have been successfully unsubscribed from commercial messages. You can customize this page by navigating to **Developers** > **Preferences**, then clicking the **Unsubscribe** tab. | ||||||
|
||||||
### Standard confirmation page | ||||||
|
||||||
You can customize the title and body text that will appear on the Knock confirmation page. | ||||||
|
||||||
### Custom redirect URL | ||||||
|
||||||
You can provide a URL that recipients should be redirected to after unsubscribing. | ||||||
Comment on lines
+55
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, we could maybe cut these two subheaders completely and mention what is customizable under the "Configuring the confirmation page header" (i.e. without having separate sections), or we should include screenshots under these subheaders. |
||||||
|
||||||
## Preference evaluation rules | ||||||
|
||||||
When a recipient clicks the unsubscribe link, their default preference set will be updated, marking `commercial_unsubscribe` as true. They will be opted-out of commercial messages, and they will continue to receive transactional messages based on their other preferences. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: how do we handle this for tenant-specific preferences? What happens if a |
||||||
|
||||||
## Learn more | ||||||
|
||||||
To learn more about managing recipient preferences and building preference centers with Knock, visit our [preferences overview](/preferences/overview). |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,6 +15,8 @@ When Knock runs a workflow for a user, we evaluate their `PreferenceSet`. A mess | |||||
|
||||||
A preference set is built using three keys: `categories`, `channel_types`, `workflows`. These keys resolve to boolean values to determine if a user has opted out of receiving a notification. | ||||||
|
||||||
The default preference set also has the `commercial_unsubscribe` which determines if the recipient should receive notifications sent by commercial workflows or broadcasts. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should include an example below? Also I think there are a few things we could disambiguate here:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see we include some of this on the other page under "Preference evaluation rules". I think it doesn't hurt to include at least some of the info in both places, in case someone reads the preferences overview page without looking further into commercial unsub. Perhaps linking from here to |
||||||
|
||||||
A few examples: | ||||||
|
||||||
```json title="Unsubscribe user from admin category notifications" | ||||||
|
@@ -241,6 +243,7 @@ When a workflow is triggered, Knock will evaluate the preferences for each `reci | |||||
|
||||||
</Accordion> | ||||||
</AccordionGroup> | ||||||
|
||||||
## 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](/reference#bulk-operations). | ||||||
|
@@ -258,3 +261,4 @@ You can update the preferences of up to 1000 users in a single batch by using th | |||||
- [Object preferences](/preferences/object-preferences). In the guide above, we referred to user preferences. You can also set preferences for objects. | ||||||
- [Preference conditions](/preferences/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). | ||||||
- 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](/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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a backlink to https://docs.knock.app/preferences/overview#preference-evaluation-rules here? And might be helpful to include some additional information about commercial unsubscribe in that section as well.