docs/.mintlify/skills/manage-preferences/references/workflow-preferences-examples.md
import { workflow } from "@novu/framework";
const myWorkflow = workflow("general-notification", execute, {
preferences: {
all: { enabled: true, readOnly: false },
},
});
const emailOnlyWorkflow = workflow("weekly-report", execute, {
preferences: {
all: { enabled: false },
channels: {
email: { enabled: true },
},
},
});
const securityAlertWorkflow = workflow("security-alert", execute, {
preferences: {
all: { enabled: true, readOnly: true },
},
});
const orderUpdateWorkflow = workflow("order-update", execute, {
preferences: {
all: { enabled: true, readOnly: false },
channels: {
email: { enabled: true },
sms: { enabled: false }, // off by default, subscriber can enable
push: { enabled: true },
chat: { enabled: false },
inApp: { enabled: true },
},
},
});
const commentWorkflow = workflow("new-comment", execute, {
preferences: {
all: { enabled: false },
channels: {
email: { enabled: true },
inApp: { enabled: true },
},
},
});
Subscribers must opt in:
const optInWorkflow = workflow("beta-updates", execute, {
preferences: {
all: { enabled: false, readOnly: false },
},
});