How to check the subscription status of a user and capture the identifier?

It is very easy to capture the subscription status of a subscriber when you are trying to build an internal mapping to CRM or capturing the subscribers in your database.

There is a simple JavaScript API ‘User Subscription Status.

This API call returns user subscription status in the form of an object.

      // Code to return response


{statuscode:1,status:"SUBSCRIBED",message:"User subscribed successfully",data:{subscriber_hash:"UserUniqueId"}}
{statuscode:2,status:"DENIED",message:"User denied push notification"}
{statuscode:3,status:"CLOSED",message:"User closed subscription Opt-in"}
{statuscode:20,message:"Your website url is not allowed, please configure in PushEngage correctly"}
{statuscode:21,message:"Your browser does not support PushEngage web push notification"}
{statuscode:22,message:"User not subscribed"}

Along with the status code, the subscriber hash (Subscriber identifier) is also added to the response code. This can be saved from the javascript variable and later mapped in your database.

Subscriber hash is the unique identifier of web push notifications that can be used for deeper API integrations.

If in case you run into any issues, please feel free to contact us by clicking here. Our support team would be able to help you.

Still stuck? How can we help?
Last updated on December 29th, 2022

Engage and Retain Visitors AfterThey’ve Left Your Website

Increase the value of every web visit with Push Notifications that are hard to miss.

  • Forever Free Plan
  • Easy Setup
  • 5 Star Support