If you want to manage your active device count by removing devices where users have turned off push notifications for your app, you can do so using the "Push Alerts Enabled" tag and Pushwoosh APIs. Devices with the "Push Alerts Enabled" tag set to false
have valid push tokens but will not display notifications because the user has opted out at the OS level.
Here’s how you can perform a cleanup:
Using Pushwoosh API (Recommended for regular or bulk cleanup):
This process involves exporting the segment of devices and then unregistering them in bulk.
-
Export Devices with Push Alerts Disabled:
- Use the
/exportSegment
API to get a list of devices where the "Push Alerts Enabled" tag isfalse
. -
Request URL:
POST https://api.pushwoosh.com/api/v2/audience/exportSegment
-
Request Body:
{ "auth": "YOUR_API_ACCESS_TOKEN", "applicationCode": "YOUR_APPLICATION_CODE", "filterExpression": "AT(\"YOUR_APPLICATION_CODE\", \"Push Alerts Enabled\", eq, false)", "generateExport": true, "format": "csv" }
- Replace
YOUR_API_ACCESS_TOKEN
with your Pushwoosh API access token andYOUR_APPLICATION_CODE
with your application's code. - The API response for this call will include a
task_id
.
- Use the
-
Retrieve Exported Segment Data:
- Use the
/exportSegment/result
API with thetask_id
obtained in the previous step to get a download link for the CSV file. This file will contain the hardware IDs (HWIDs) of the devices in the segment. -
Request URL:
POST https://api.pushwoosh.com/api/v2/audience/exportSegment/result
-
Request Body:
{ "auth": "YOUR_API_ACCESS_TOKEN", "task_id": "TASK_ID_FROM_STEP_1" }
- Use the
-
Bulk Unregister Devices:
- Once you have the list of HWIDs from the downloaded CSV file, use the
/bulkUnregisterDevice
API method to remove these devices from your Pushwoosh application. - This method allows you to unregister multiple devices in a single API call, which is more efficient than unregistering them one by one.
- Refer to the official Pushwoosh API documentation for the detailed request structure for
/bulkUnregisterDevice
: Pushwoosh Audience API - bulkUnregisterDevice
- Once you have the list of HWIDs from the downloaded CSV file, use the
You can automate this entire process by creating a script that performs these API calls periodically (e.g., monthly) to maintain an up-to-date and relevant device list.
One-Time Cleanup by Pushwoosh Support:
If you require a one-time cleanup and are not yet able to implement the API solution yourself, you can contact Pushwoosh support. They may be able to assist with unregistering devices where "Push Alerts Enabled" is false
as a one-time service.
Comments
0 comments
Please sign in to leave a comment.