[question]: Trigger push notification will cause subscription status changed to `Not Subscribed`, after upgrading SDK from v4 to v5
How can we help?
Trigger push notification from my backend:
Request:
{"app_id":"cffcf292-2336-475e-b0bb-d6fea16516f2","include_external_user_ids":["TT.STAF.013.0000.132"],"data":{"title":"Dealer Account Renewal","message":"Hi bzbshsb\n\nCongratulations! Your Tune Talk Dealer Class Renewal is Successful To Another 1 Months Start From Today.","date":"2024-06-12 11:22:26"},"contents":{"en":"Hi bzbshsb\n\nCongratulations! Your Tune Talk Dealer Class Renewal is Successful To Another 1 Months Start From Today."},"headings":{"en":"Dealer Account Renewal"},"content_available":true,"ios_badgeType":"Increase","ios_badgeCount":"1","large_icon":"https://tunetalk-dealers-mobile-app.s3.amazonaws.com/public/logo.png","huawei_msg_type":"data"}
Response:
{"id":"4c4e3a61-1824-4930-889a-e77825acca5e","external_id":null,"warnings":{"invalid_external_user_ids":"The following external_ids have unsubscribed subscriptions attached: [\"TT.STAF.013.0000.132\"]"}}
When I check the subscription status from portal, the status suddenly became Not Subscribed and my device didn't receive the push notification. Here is the response of the event-timeline request that I noticed from the web browser network console.
{
"success": true,
"payload": {
"id": "69aed89b-b77c-4030-bc10-728a2478c7a9",
"aliases": null,
"country": "MY",
"created_at": "2024-06-06T15:11:15.000Z",
"device_model": "SM-T510",
"device_os": "11",
"device_type": "android",
"device_type_id": 1,
"event_timeline": {
"items": [],
"counts": 0,
"pagination": null
},
"external_id": "TT.STAF.013.0000.132",
"game_version": "888",
"identifier": null,
"invalid_identifier": true,
"ip": "2001:f40:906:3a79:817d:45e:be4f:c233",
"language_code": "en",
"last_active_at": "2024-06-12T03:07:30.000Z",
"location": {
"x": 0,
"y": 0
},
"onesignal_id": "2e650685-8f40-4ed0-9e2c-4d40f214d28f",
"playtime": 0,
"rooted": false,
"sdk": "050114",
"session_count": 2,
"subscription_reason": "This subscriber uninstalled your app, cleared site data, has an expired token, or has been inactive for over 270 days.",
"subscription_status": "not_subscribed",
"tags": {},
"timezone_id": "Asia/Kuala_Lumpur",
"unsubscribed_at": "2024-06-12T03:22:26.000Z"
}
}
Seems like the subscription became not subscribed at the time when the push notification was triggered, I wonder why this is happened in v5 SDK but it was okay in v4 SDK.
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
To help see what is happening in the app, please follow this guide while reproducing the issue:
SDK v5+ https://documentation.onesignal.com/docs/capturing-a-debug-log
This will generate additional logging in the app and might help narrow down the cause.
Please share the entire logs from app start to end of reproduction as a .txt along with steps taken to reproduce the log and any additional information or code being used.
@chrischeng9297 There should be no change between v4 and v5 with this behavior.
When you uninstall and reinstall the app you will get a new player_id (v4) or a new subscription_id (v5), so make sure you are using the newest id when you send a push. If you use the old id to send a push, FCM will tell OneSignal that the pushToken is no longer valid so the status will update to unsubscribe to accurately reflect that.
If that is not the scenario you are running into please provide the details jfishman1 asked for above.
Closing due to no response
We're facing a similar problem. Users with v4 are not receiving notifications when they upgrade to v5 (without opening the app).