N
Novu11mo ago
psrihariv

SetCredentials behavior on setting repeatedly

await novu.subscribers.setCredentials('subscriberId', PushProviderIdEnum.PushWebhook, { deviceTokens: ['ANY_RANDOM_STRING'], }); What happens when the above is called multiple times for a given subscriberID? Because I am noticing for certain users my webhook is trigger multiple times where I expect it ot be single time. Also if the "ANY_RANDOM_STRING" is different would it register that webhook as for different device. If we cannot invoke multiple times and it would considered different devices is there any way we can get if the subscriber with subscriberID has cerdentials set? If there is exact documentation of the behaviour please point out.
5 Replies
Pawan Jain
Pawan Jain11mo ago
@psrihariv deviceTokens is of type array. novu will make POST request to webhookUrl exactly same time as the length of deviceTokens array
psrihariv
psriharivOP11mo ago
@Pawan Jain Okay everytime setCredentials is called a new item is inserted into the deviceTokens array? Is there anyway I can manage that array like delete items? please let me know.
Novu_Bot
Novu_Bot11mo ago
@psrihariv, you just advanced to level 2!
psrihariv
psriharivOP11mo ago
Just to add one other quesion: novu.subscribers.identify(id); calling identify multiple times for same ID doesn't create multiple subscribers, right?
Pawan Jain
Pawan Jain11mo ago
@psrihariv checkout this section for this https://docs.novu.co/channels-and-providers/push/overview#1-how-to-remove-one-device-token-from-subscriber-credentials Yes, it shows update behaviour second time for setCredentials deviceToken, we have unique check in place. So we make sure only unique tokens are stored
Want results from more Discord servers?
Add your server