novu
novu copied to clipboard
🚀 Feature: Expiration Time for FCM Tokens
🔖 Feature description
Following to Firebase docs, They recommend us to store tokens with expiration time and remove token if it staled. Also it would be nice to have option to remove token from user if it's being connected to another.
🎤 Why is this feature needed ?
- Avoid forcing user to have a cron job and update all users tokens (it will be huge load for Novu).
- Novu's database would be clean of salted and outdated tokens
- Avout filtering users and remove token from them.
✌️ How do you aim to achieve this?
I want this feature to follow firebase best practice, avoid creation of cron job which will update all users tokens in novu, and removing token when user logged out from app.
🔄️ Additional Information
No response
👀 Have you spent some time to check if this feature request has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Contributing Guidelines
Are you willing to submit PR?
No response
Sounds good would like to work on it if it has been approved !
@KlausMikhaelson assigned you 🙏
Thank you @scopsy will start working on it !
Hey @scopsy quick update: I was travelling a lot from the past 2 weeks so forgot to work on it but I am at home now and have started the work !
Hey @KlausMikhaelson! How is it going so far? Any updates?
Hi! We're considering adding Novu to our company right now and this feature would be really helpful. How would you picture this working @scopsy? Through a MongoDB TTL index or a cron job that deletes stale tokens? I could help with this if needed :)
@tomcastro mongodb ttl might one way, the problem is that we will need to extract the whole credentials to another collection for it. And I'm afraid that managing this on the database level will have a lot of limitations. So perhaps doing this as part of the application layer might even work better and will be more customizable in that sense.
Hi @scopsy Why can't we use a silent notification firebase API to send a notification to the user via cron? If we can't send a notification to that user, we may just remove that token from the database.
@SRICHARANSIRPA that's a good point, we can also try to extract the mapped stale token errors with it. And then remove when an exception of such type happened
@scopsy if my above suggestion is approved, am happy to work on it
@SRICHARANSIRPA how do you plan on choosing to which token to try sending silent notification? in other words, when the cron triggers based on what criteria do you pick the token to send the notification to?