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:
var dto = new EventTopicTriggerDto()
{
EventName = "{WorkflowTriggerId}",
Topic = new EventTopicDto()
{
TopicKey = "{TopicKey}"
},
Payload = new
{
UploaderId = "{UploaderId}",
}
};
await _novuClient.Event.TriggerTopicAsync(dto);
var dto = new EventTopicTriggerDto()
{
EventName = "{WorkflowTriggerId}",
Topic = new EventTopicDto()
{
TopicKey = "{TopicKey}"
},
Payload = new
{
UploaderId = "{UploaderId}",
}
};
await _novuClient.Event.TriggerTopicAsync(dto);
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
Pawan Jain
Pawan Jain12mo ago
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/
Pawan Jain
Pawan Jain12mo ago
Sebastian Küsters
Interesting and how would I use the Actor in the Filter?
Pawan Jain
Pawan Jain12mo ago
So if you send subscriberId as actor, we will not send notification to that subscriber
Novu_Bot
Novu_Bot12mo ago
@Pawan Jain, you just advanced to level 27!
Pawan Jain
Pawan Jain12mo ago
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
Sebastian Küsters
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?
Novu_Bot
Novu_Bot12mo ago
@sebastiankuesters, you just advanced to level 1!
Pawan Jain
Pawan Jain12mo ago
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
Prosper
Prosper12mo ago
Looking into it
Sebastian Küsters
@Pawan Jain will try it out later