OneSignal / onesignal-ngx

OneSignal Angular
Other
5 stars 5 forks source link

logoutSms() not un-subscribing user from sms notifications #12

Closed AlanBird1999 closed 2 years ago

AlanBird1999 commented 2 years ago

Description: We have a chat system set up to send an sdk request to message each user with a given external ID each time they receive a message. When a user enables this feature we set their number with their external user ID using oneSignal.setSMSNumber('UsersNumber'), then when a user turns off this feature we call oneSignal.logoutSMS() so they will not receive any further sms messages. However after calling logoutSMS() the user can still receive sms messages and no change is reflected on the onesignal dashboard.

Environment

Installed through npm

Steps to reproduce issue:

  1. Set users external id with oneSignalService.setExternalUserId(_id)
  2. Register user number with oneSignal.setSMSNumber('UsersNumber')
  3. Call onesignal.logoutSMS()
  4. Send message to user using sdk call "channel_for_external_user_ids": "sms", "include_external_user_ids": ["_id"]
  5. User still receives sms message
jkasten2 commented 2 years ago

@AlanBird1999 Thanks for your question. logoutSms() does not unsubscribe the subscription, it just prevents future updates from the device such as tags or other properties. In your case since you are using external_user_id to target you can remove this value before logging out.

// You should await before calling logoutSMS() so the external id is remove before logout.
await OneSignal.removeExternalUserId();
await OneSignal.logoutSMS();
AlanBird1999 commented 2 years ago

That is the functionality I was looking for, thanks!