Open kienvtqhi opened 1 year ago
Same issue here. I'm trying to migrate from device-centric to the user-centric model. From the app everything works. Now I'm writing a migration script that loops over all subscription IDs of a user. For the first subscription, it gets the onesignal_id using GET https://onesignal.com/api/v1/apps/${onesignalAppId}/subscriptions/${subscriptionId}/user/identity
.
Then it creates an alias by doing PATCH https://onesignal.com/api/v1/apps/${onesignalAppId}/users/by/onesignal_id/${oneSignalId}/identity
.
For the rest of the subscriptions connected to a user, I transfer the subscriptions using PATCH https://onesignal.com/api/v1/apps/${onesignalAppId}/subscriptions/${subscriptionId}/owner
.
I've tested this approach manually and it seems to work. I have now ran my script on 1 user and when I get that user by external_id
, it properly shows me all subscriptions connected to that user.
However, when I now try to send a notification, I get this:
{"id":"","errors":{"invalid_aliases":{"external_id":["3cc7a2ba-91ea-4b18-93fc-c2123e458c6e","3cc7a2ba-91ea-4b18-93fc-c2123e458c6e","3cc7a2ba-91ea-4b18-93fc-c2123e458c6e","3cc7a2ba-91ea-4b18-93fc-c2123e458c6e","3cc7a2ba-91ea-4b18-93fc-c2123e458c6e"]}}}
Thoughts, @emawby?
It happens when notifications permission is not enabled by user on device.
@malikmajai I could see the logic there, but sending a notification to that external_id
then fails as a whole. Even the linked subscriptions that do have permissions enabled don't get the notification. If you're sending a notification to 3 devices, where 1 device is not properly configured, the other 2 should still get the notification. Otherwise the whole user-centric model doesn't have any value.
This is still happening for today, do anyone has a workaround on this or should we just send to each individual user?
How can we help?
Hello,
I am using create notification API with included_aliases to send the notification to the specified user by external_id.
But it is failed. It return the
invalid_aliases
.What's wrong? Please help me to fix it.
Thank you so much!
Code of Conduct