Skip to content
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

feat(framework): Add workflow channel preferences docs #695

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions sdks/framework/typescript/steps/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,42 @@ type ProviderOverrideOutput = {
```

The `_passthrough` object and the known provider values are deeply merged prior to sending the request to the provider, with the `_passthrough` object taking precedence.


### Workflow channel preferences
davidsoderberg marked this conversation as resolved.
Show resolved Hide resolved

By default, Novu will show the subscriber preferences in the Inbox component. Subscribers can enable/disable any active channel in the workflow using subscriber preferences.
With Workflow channel preferences you can control what the default preference for a channel is and also if subscriber can change it.
davidsoderberg marked this conversation as resolved.
Show resolved Hide resolved

You can specify inApp, sms, email, chat and push in channels object, each of these takes an object with defaultValue that controls if a channel is enabled/disabled by default for subscriber.
davidsoderberg marked this conversation as resolved.
Show resolved Hide resolved
The readOnly property controls if subscriber can change if a channel is enabled/disabled.
davidsoderberg marked this conversation as resolved.
Show resolved Hide resolved

ReadOnly and defaultValue on workflow object is used for a channel that is not specified in channels object so if a new channel is introduced in workflow and specific preferences for that channel is specified these will be used instead.
davidsoderberg marked this conversation as resolved.
Show resolved Hide resolved

These preferences can also be controlled from the Novu dashboard on a workflow, click on the cog and then preferences to do this.
davidsoderberg marked this conversation as resolved.
Show resolved Hide resolved

```typescript
const newWorkflow = workflow(
'hello-world-preferences',
async ({ step }) => {
await step.inApp('send-in-app', () => ({
subject: 'Welcome!',
body: 'Hello there',
}));
},
{
preferences: {
workflow: {
defaultValue: false,
readOnly: true,
},
channels: {
inApp: {
defaultValue: true,
readOnly: true,
},
},
},
}
);
```