Following up: Removing Stale Device Tokens
Hi Novu Team,
This is a follow up on this thread https://www.answeroverflow.com/m/1204347030634369074
We’re using Novu to send push notifications via APNS and FCM, with the following requirements:
Support users logged in on multiple devices, ensuring notifications are sent to all active devices.
Prevent accumulation of stale/expired device tokens to maintain efficient delivery and accurate reporting.
For the first requirement, we can upsert device tokens to a user’s deviceTokens array on sign-in and remove specific tokens on sign-out. However, for the second requirement, we’re struggling to identify and remove stale tokens (e.g., tokens expired due to app uninstalls or inactivity). From my understanding, Novu doesn’t automatically detect or remove stale tokens, and I couldn’t find a clear solution in this related thread:
Could you clarify:
Does Novu provide a way to detect or validate stale APNS/FCM tokens (e.g., via error responses or a validation API)?
Are there best practices for proactively removing stale tokens to avoid delivery failures?
If Novu doesn’t handle this automatically, are there plans to add such functionality?
Thanks for your help!
Justin
10 Replies
Hi @BamGoingHam thanks for asking that! This is actually on the roadmap, and work should start in the next 6 weeks. @Pawan Jain I’ll let you follow up here 🙂
Also @BamGoingHam feel free to share what you would like to see as part of that 🙏🙏
@Tomer Barnea That is great to hear. So with that in mind, is it safe to say this future work would retro-activley clean up stale tokens? As well does this mean there is no workaround to this right now?
Yes, you are correct. We are planning to add support for cleaning these tokens automatically. Currently, it is not supported
Is there any known side effects if we just leave the stale tokens in?
@BamGoingHam, you just advanced to level 1!
@Pawan Jain
Not a major issue, push notifications will fail to deliver
@Pawan Jain okay sounds great, last thing I want to validate. Say if one user has multiple device tokens and a few of them are stale and therefor those stale tokens fail to send, this will not interfere wtih the sending, or retry (exponential backoff) logic on the other (valid) device tokens when they are trying to send?
No, it will not affect the active and valid tokens
Great, thank you