How to filter PUSH step with only subscribers that have credentials set?
Otherwise I get "Subscriber does not have a configured channel" for the PUSH step on subscribers that still do not have credentials added.
11 Replies
Hi @frnandu
Credentials is required to PUSH step to work
Checkout this method
https://docs.novu.co/channels-and-providers/push/fcm#setting-device-token
Yes, but If I have a workflow with PUSH & IN-APP and a large group of subscribers that I want do send, and some of them have PUSH credentials added, but others don't, how do I send to everybody so that the ones that have credentials receive PUSH and the ones that don't have only IN-APP? the PUSH step throws a bunch of errors for people that do not have credentials.....
@frnandu, you just advanced to level 1!
@frnandu
IMO if your subscriber does not have push provider credentials, push step will be failed for those subscribers but in-app step will still be successful
Yes, only the PUSH step will fail but it will spam error logs and activity, so my question is shouldn't we be able to filter them out of the push step to avoid those errors and log spam?
I've tried adding filter on Subscriber with Key "credentials" is Defined, but it doesn't work...
Yeah, you are right
Currently, filters does not work on credentials property of subscriber
There is one workaround, you can use webhook filter, we will send subscriber details to the webhook url. In your system, you can do validation if subscriber has token or not and then return response based on that.
novu will check webhook url response and check with filter condition.
based on that push step will be active/inactive for that user
Let me know if this will work for your usecase
Considering I'm sending hundreds of thousands of notifications, calling a webhook for each would probably cause it to take several days to send everything. I don't think this is an option. Couldn't you just support filtering by credentials on PUSH step?
I could try to submit a PR, if you could just point me to where in the code this filtering is done. Thanks
@frnandu
Thanks for your interest in contribution
This is the main file for filter processing
https://github.com/novuhq/novu/blob/next/apps/worker/src/app/workflow/usecases/message-matcher/message-matcher.usecase.ts
@frnandu if you do end up working on it, please let me or @George know and we'll update you on where to work from 🙂 We have a complete rewrite of that file in a separate feature branch - for a feature that is still a WIP.
what's the branch name?
the branch name is
NV-2868-deprecated-messagematcher-and-switch-to-conditions-filter
We are removing the duplicated code and merging the logic to ConditionsFilter use case