Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to delete a user via API for OneSignal?

Tags:

onesignal

When I delete a user from my backend I also want to delete the entry from the OneSignal database to keep my numbers and pushes precise (also important for A/B testing). Is there a way to do that? I searched the API but I couldn't seem to find anything to delete an entry.

Thanks!

like image 350
Markus Avatar asked Nov 01 '16 19:11

Markus


2 Answers

OneSignal intentionally does not support deleting users through the API. It is possible to delete users individually on the dashboard, but this is mainly meant for removing devices for troubleshooting when first setting up OneSignal on your website or app.

Here are the reasons why deleting users via the API is not currently supported:

  1. Users who are unsubscribed may later re-subscribe to notifications. Keeping this user data around allows OneSignal to continue accurately tracking metrics such as session count, usage duration, and tags.
  2. OneSignal's automatic notifications feature is designed to avoid delivering the same notification twice to users who have previously received it. Deleting users could interfere with this mechanism.
  3. Clients often want to see data about unsubscribed users through the OneSignal dashboard or API.
  4. Deleting users who currently have your app installed may cause unexpected behavior when using certain OneSignal methods in your app, such as SendTags.
like image 160
Gdeglin Avatar answered Oct 05 '22 16:10

Gdeglin


You can use this line to unsubscribe user from receiving the notifications:

OneSignal.setSubscription(false)
like image 31
Musa almatri Avatar answered Oct 05 '22 15:10

Musa almatri