Subscriber Status
A subscriber is a user who has opted in to receive notifications from your website. This endpoint determines whether a subscriber is active, accepts form-encoded request bodies, and returns the response in JSON format.
POST
https://api.pushengage.com/apiv1/subscribers/check
info
In some APIs, the term subscriber_hash
is used. However, the same reference is called subscriber_id
in the web SDK. As a result:
- Web SDK: consistently uses
subscriber_id
. - API: opts for
subscriber_hash
.
Request Parameters
Parameter Name | Type | Required | Description |
---|---|---|---|
subscriber_hash | String | Yes | This is the unique ID for a subscriber. It is generated when a user grants permission to receive push notifications. |
Response Object
Property Name | Type | Required | Description |
---|---|---|---|
success | Boolean | Yes | Indicates whether the push request succeeded or not. Values can be true or false . |
message | String | No | Provided in case of failure to denote the reason for failure. |
Example
Request
- cURL
- PHP
curl -X POST -H "api_key: <your_pushengage_api_key>" -H "Content-Type: application/x-www-form-urlencoded" -d 'subscriber_hash=ety67HgTYgKl8' "https://api.pushengage.com/apiv1/subscribers/check"
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.pushengage.com/apiv1/subscribers/check",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "subscriber_hash=ety67HgTYgKl8",
CURLOPT_HTTPHEADER => array(
"api_key: <your_pushengage_api_key>",
"content-type: application/x-www-form-urlencoded"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
Response
- 200 OK
- 401 Unauthorized
- 400 Bad Request
{
"success": true
}
{
"success": false,
"message": "API KEY Invalid"
}
{
"success": false,
"message": "No Active Subcribers Found for the given subscriber_hash"
}