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 subscriber data mapping GRW-11 #6031

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

scopsy
Copy link
Contributor

@scopsy scopsy commented Jul 10, 2024

What changed? Why was the change needed?

https://github.com/novuhq/packages-enterprise/pull/164

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

Copy link

linear bot commented Jul 10, 2024

@@ -5,4 +5,7 @@ export type Subscriber = {
email?: string;
phone?: string;
avatar?: string;
data?: Record<string, any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we strongly type data? I don't think we shouldn't have any interfaces exposed to the Framework consumer, it weakens the type safeness of their Novu integration. We should probably explore type declaration merging on this data object instead.

As a related follow-up, what is the origin of data on the subscriber?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to be this data property on the Subscriber's POST /v1/subscriber request. Given that such data lookups should now happen during the code-first Workflow execution to ensure maximum data freshness, I think we can remove this attribute entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think it can serve a different purpose with v2, but let's touch base on this over a coffee later. Want to brainstorm a little on this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So citcle back on this,
I do still see some usecase where users might want to persist some subscriber entity related data that is part of the notifications domain.

Some examples currently where customer have some complex preference logic and they want to persist it inside of the subscriber and later use to manipulate the workflow.

I think it still very usefull ability, to not force our customers worry about storing this notification related custom data somewhere on their servers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the any, it makes sense. Where would you provide such a global type?

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

Successfully merging this pull request may close these issues.

None yet

2 participants