N
Novu6mo ago
kmp

Review Required For Integration Approach.

Below is the system I aim to build and Approach I took. Can you please review and let me know if there is any better way we can integrate with Novu ? - The system consists of U users, each with access to at most E entities. - Each user can access only one entity at a time. - I aim to manage notification preferences at each User X Entity level. - Notifications are sent at the entity level, and all users with access to the entity will receive the notification based on their preferences for that entity. - As of now, the system will only support InApp, Email, and Slack as notification mediums. - The system currently contains approximately 10000 entities and around 4000 users. - There are 30 different types of notifications in the system. Approach I've taken:
Created 1 Topic for each Entity X Medium (e.g., E1_InApp, E1_Email, E1_Slack). For each user, I've created 1 subscriber and subscribed them to the respective topics based on their access. I've created 1 workflow per notification, with each workflow consisting of 3 steps (Inapp -> Email -> Slack). Each workflow includes conditions for selecting the medium using the topic key suffix.
Example: If User1 has enabled InApp notifications for E1 and E2, and email notifications only for E1, then User1 will be part of E1_InApp, E1_Email, and E2_InApp Topics. Whenever we trigger a workflow targeting the respective Topic, the notification will be delivered to corresponding users in the chosen medium. Also in this approach I will need to manage notification preferences in a seperate service, as Novu supports Notification Preferences at Subscriber level. Is there something better we can do here ?
4 Replies
Pawan Jain
Pawan Jain6mo ago
Hi @kmp Thanks for sharing the detailed use case and approach you took. Notification Preference:- Preference can be set in three levels: 1. Workflow Default Preferences (will be applied to all subscribers) 2. Subscriber's preference at the workflow level 3. Subscriber's preference at global level Checkout docs:- https://docs.novu.co/subscribers/preferences Topics:- Topics are just a way to group the subscribers in a list. It does not have preference attached to it Checkout docs:- https://docs.novu.co/subscribers/topics
If User1 has enabled InApp notifications for E1 and E2, and email notifications only for E1, then User1 will be part of E1_InApp, E1_Email, and E2_InApp Topics.
As topics does not have preference attached to it so this will not work
kmp
kmp6mo ago
Thank you for your reply. I have been creating one topic for each medium, and it works fine for me. I wonder if there is any way to optimize my approach further. With this approach, I will end up creating about ~60,000 topics. Is there a limit on the number of topics that I can create? Will having too many topics affect the performance?
Pawan Jain
Pawan Jain6mo ago
@kmp There is no such limit on number of topics currently. 60000 will work without any performance issue As per your case, your approach is efficient
kmp
kmp6mo ago
Thanks for confirming @Pawan Jain Extending the same, I realized I need to configure preferences at Entity X Medium X Notification - User1 for Entity1 wants EntityUpdateNotifications only InApp and Email. - User1 for Entity2 wants ALL only in Slack. - User2 for Entity1 wants EntityDeleteNotifications only in InApp. As discussed we cannot configure preferences at an Entity Level (Topic). The only way that I can think as of now is to create a Topic for Entity X Medium X Notification Which results in almost 10000 (Entities) * 3 (Mediums) * 11 (Notification Types) = 3,30,000 Topics. Can you please let me know if this approach is still fine ? and with these many topics will the system be performing fine?