How to Check if a User is Unsubscribed from Push

We are searching for a method which helps us to detect that user has un-subscribed for notification.
Currently we have implemented webpushr notification in our testing website. Whenever any user subscribed for push notification we are storing its subscriber id in our db and later we are sending notification to that subscriber using API. To get subscriberid , we are using FetchId method. Now my question is, suppose, if a user unsusbscribed for notification how we can detect it has unsubscribed for notification.

  1. Is there any event which help us to detect unsubscribed user after unsubscribing?
  2. If there is no js method then how we can keep record in our db for those user. Is there any alternative solution for that. For example any API which will provide list of all un-subscribed users?
  3. If a user unsubscribed successfully then what are the steps to prompt subscribe dialog again to user… Currently new user is getting subscribing dialog but once they subscribed and after that if they unsusbscribed they are not getting prompt dialog again. I want to show my users that dialog box again. Please help me on it.

Hi @Rajneesh13089,

Thank you for using Webpushr.

How to detect if a user is subscribed to Push Notifications:

You can use the permission read-only property of the Notification interface to check subscription status.

You can also use our Fetch SID method which will return a false value if the user is not subscribed.

We currently do not have an API that gives you a list of unsubscribed users because we permanently delete them from our servers.

How to re-prompt users who have unsubscribed from push:

  • If the user has denied push (see screenshot below), our SDK cannot re-prompt. They must manually change their notification permission status (see the screenshot).

  • If the user has not denied push but is no longer subscribed (because they got a new computer/browser/etc.) then they should see the prompt.

  • If the user has dismissed our Custom Prompt, then they should see the custom prompt again based on how you have configured re-prompt delay in your prompt settings.

Hope this helps.