N
Novu•5mo ago
Nexen

exclude from topic more actors

Hello, was intentional to have just one actor to be excluded? For my usecase i would like to exclude more subscribers.
const topicKey = 'posts:comment:12345';

await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: topicKey }],
payload: {},
actor: { subscriberId: ['<SUBSCRIBER_ID_1>', '<SUBSCRIBER_ID_2>'] },
});
const topicKey = 'posts:comment:12345';

await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: topicKey }],
payload: {},
actor: { subscriberId: ['<SUBSCRIBER_ID_1>', '<SUBSCRIBER_ID_2>'] },
});
13 Replies
Ask Inkeep
Ask Inkeep•5mo ago
Hi @Nexen, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Topics * General * Subscribers * User Management -----------------------------
Ask Inkeep
Ask Inkeep•5mo ago
Answer The current implementation of Novu's API, as per the documentation available, appears to allow for the exclusion of a single actor from a topic trigger event. This is demonstrated with the use of the actor field, where a subscriberId can be specified to exclude the actor responsible for the action that triggered the event (1) . However, the official documentation does not directly address the scenario of excluding multiple actors from a topic trigger event with syntax similar to what you've suggested. The inclusion of multiple subscriberIds within an array for the actor field is not explicitly documented. For more complex use cases like yours, where you need to exclude multiple subscribers, the documentation does not provide a clear solution. Given this limitation, it might be necessary to explore alternative approaches or workarounds that fit within the current capabilities of Novu's API. For the most accurate and up-to-date information, and to discuss potential feature requests or enhancements, it might be worth engaging directly with the Novu community or support channels.
Sources [1] Topics
Ask Inkeep
Ask Inkeep•5mo ago
Got it. Tagging @Support for additional help.
Tomer Barnea
Tomer Barnea•5mo ago
@Nexen can you explaing that? What is the underlining use case you are resolving?
Nexen
Nexen•5mo ago
@Tomer Barnea sure, i want array of subscribers to exclude from topic send. for example: topic covers every subscriber. Based on trigger i can define if dev team should get it too.
Tomer Barnea
Tomer Barnea•5mo ago
@Nexen can you give a full example of the use case of a potential trigger and when would you exclude the dev team? I don't sure I follow
Nexen
Nexen•5mo ago
I dont think its that complicated. Have every user in topic called "general". Trigger new notification for everyone in topic "general" -> all good Trigger new notification for everyone in topic "general" except 10 users (dev team) -> ? i dont have code for you, because im in the process of ticking checkboxes.
Tomer Barnea
Tomer Barnea•5mo ago
Got it @Nexen thanks, that makes sense, @Pawan Jain @Dima Grossman can you please advise here?
Pawan Jain
Pawan Jain•5mo ago
@Nexen Thanks for sharing the usecase. Here you are looking to consider a group of subscribers or another topic as actor Currently, only one subscriber can be considered as an actor. Sharing this feature request with our team
Nexen
Nexen•5mo ago
Ah i see, the usecase for is would be that the notification should go to everyone, but under a certain conditions, the dev team does not care, so it should not send it. If i go the other way, that i would send a trigger and list specific subscribers, how much can i have? is there batching? for example sending one notification to 200k people (that way i can control the dev team include)
Tomer Barnea
Tomer Barnea•5mo ago
@Nexen another way you can tackle this is by creating smaller functional topics, and trigger a couple of them, so you can "select them", can that work? edit In another thought, I am not sure this is the best way to go, as this will raise the need of maintaing a statful solution on your end, let me know what you think..
Nexen
Nexen•5mo ago
smaller functional topics would not work for me unfortunately. I have more things like that on my backend stuff. This example i gave you is one of the simple ones. One i have is that user creates a post. Post has to be activated by admin. When its activated, everyone should get notification about new post. User should get "your post has been created" and admin should get nothing. - Admin is in the topic too (to get notifications about different posts) - User is in the topic too (to get notifications about different posts) So when i have all in topic, i can exclude the one who created it, but what about the post creator? Would if else in workflow work if i specify some custom params to check against?
Tomer Barnea
Tomer Barnea•5mo ago
@Nexen let me add @Dima Grossman @radek so they can read the feedback and the ideas 😄
Want results from more Discord servers?
Add your server