Add dynamic filter to a topic
Scenario:
We want to notify all subscriber of a topic when a new file was uploaded to the server, so we are trigger an event to a topic using the .NET SDK:
Problem:
We want to add a StepFilter to the InApp- and Email-Step, that only subscribers where the subscriber ID is not equal to the UploaderId from the Payload should receive the message. (So that the uploader don't gets notified about his own upload)
Is it possible? If yes, pls comment with a screenshot of the Filter settings, here is what we tried so far:
11 Replies
Hi @sebastiankuesters
Unfortunately, we don't support dynamic values in the value field of the filter.
It expects only static values.
So the above configuration will not work.
I see you are using .net sdk and triggering a topic
You can give one subscriberId as value of actor
https://docs.novu.co/api/trigger-event/
Interesting and how would I use the Actor in the Filter?
So if you send subscriberId as actor, we will not send notification to that subscriber
@Pawan Jain, you just advanced to level 27!
let me check if actor field is supported in .net sdk
https://github.com/novuhq/novu-dotnet/blob/main/src/Novu/DTO/EventTriggerDataDto.cs#L9
I see it is missing in DTO
@unicodeveloper
I could also use the REST API instead of SDK meanwhile.
But @Pawan Jain when I set the Actor how will the Filter then look like?
@sebastiankuesters, you just advanced to level 1!
The filter will work in the same way, it will check the given condition for every subscriber except actor
So in your case you can remove above filter
and just send uploaderId as actor and Novu will exlude that subscriber from recipients
Looking into it
@Pawan Jain will try it out later