Deleting only certain Push Device Tokens

In my use case, we are using Novu to send Push Notifications to mobile app users. Some users will have multiple mobile devices but will use the same subscriber id in the novu database. To prevent them from getting notifications if they've signed out on from the app only on that device, I need to delete only the token for that device which they've signed out on. How can I do this? It seems that the delete subscriber credentials api deletes all the push tokens from that provider. I need to refine it to just delete one device token for a provider. Hope that makes sense, thanks in advance.
9 Replies
Novu_Bot
Novu_Bot7mo ago
@ginger_lemon, you just advanced to level 1!
ginger_lemon
ginger_lemon7mo ago
If there is not a way to pull or push a token from the deviceTokens list, then I would like to contribute to the project to add that functionality. I'd need some help getting started though
Pawan Jain
Pawan Jain7mo ago
Hi @ginger_lemon Thanks for showing interest in your contribution. Currently, we don't have an api/method to delete a specific token Check out this thread for the complete flow on how to delete specific token https://discord.com/channels/895029566685462578/1151537644463980655
ginger_lemon
ginger_lemon7mo ago
Thanks @Pawan Jain
Stephen
Stephen7mo ago
Actually this was my requirement too. Well there was one more problem. I want to understand how to handle when a user logs in same device with multiple user accounts. Say like they are switching accounts. So in novu there will be two users with same device tokens. Even if we handle deleting the token when the user logs out, how do we handle when the login is expired we cannot delete the token manually in this case?. Well i maybe wrong. Though I'm also interested in contributing.
ginger_lemon
ginger_lemon6mo ago
Seems like a common enough use case. Haven't found time to deep dive into the codebase yet but I think this feature would be very helpful for the FCM/APNS integrations
Pawan Jain
Pawan Jain6mo ago
@Engineering What are your views on this request? We have one similar old post
george.d
george.d6mo ago
I think creating a new endpoint for the deletion of a single token could be a good idea.