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

🚀 Feature: Customized Preference System exposed to bridge #6822

Open
2 tasks done
paulwer opened this issue Nov 1, 2024 · 3 comments
Open
2 tasks done

🚀 Feature: Customized Preference System exposed to bridge #6822

paulwer opened this issue Nov 1, 2024 · 3 comments
Labels

Comments

@paulwer
Copy link
Contributor

paulwer commented Nov 1, 2024

🔖 Feature description

With the new version v2 and the introduced bridge processing, novu could also introduce a custom preference system, where devs can define schemas for the preferences like the existing control/payload schema, which are then exposed to the customer and to the workflows as well.

🎤 Why is this feature needed ?

Several different requests like customized digest for workflows are already requested and I think with this system, the chance to support more of them out of the box is even higher.
When used with topics (#6789) the dev can define relations between topics and workflows much more specific

Use Cases I could think of:

  • Customized digest
  • Customized E-Mail behavior, f.ex. setting if email should include personal data or should be anonymized
  • Define for each topic (f.ex. asset or post) which workflow (by preference system), should be used (like github customized notifications for each repo)

✌️ How do you aim to achieve this?

  1. Define Preference Schema at workflows / maybe also on topics (🚀 Feature: Topic Processors #6789)
  2. pass them as variables to the workflow

🔄️ Additional Information

Example:

workflow("xxx", async ({ step, subscriber, preferences, topic }) => {
  const { name: topicName, control: topicControl, preferences: topicPreferences } = topic ?? {};;
  await step.digest("custom-digest", () => ({ unit: (topicPreferences?.interval ?? preferences.interval) === 'daily' ? 'day' : 'week', amount: 1 })
}, {
   preferenceSchema: z.object({
      interval: z.enum(["daily", "weekly"]).default("daily"),
   })
})

👀 Have you spent some time to check if this feature request has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Copy link

linear bot commented Nov 1, 2024

@ComBarnea
Copy link
Collaborator

@paulwer take a look at this, I think this is already on the roadmap, but I am not sure I understand. Can you explain the suggestion above? Is this only for preferences? Or something in general?
Screenshot 2024-11-04 at 11 39 47

cc @scopsy @SokratisVidros check this out

@paulwer
Copy link
Contributor Author

paulwer commented Nov 4, 2024

Hi @ComBarnea, thanks for checking this out.
From my understanding single features or preferences are already on the roadmap.
This Feature Requests focuses more on a general implementation of a customizeable preference system, which will implicitly enable users to implement those requested features by design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants