79
Views
1
Comments
Solved
Onesignal push notifications unable to find user Id

I'm developing a native android mobile app and using Onesignal for push notifications. The device is registered and I'm able to send messages from the Onesignal dashboard, but when I use the "SendPushNotificationToUserId" server action i get the error message "No devices registered for the provided UserID".

In the docs, they suggest placing the "RegisterWithUser" action right after the DoLogin:

However, I use IdP with user provisioning, so this is not an option. My login flow is in the OnException action, and looks like this (GetLoginURL is from IdP module):

I'm then redirected to the splash screen, where I have the following flow in the OnInitialize:

I don't get the error message, and the device is successfully registered. However, I can't use the SendPushNotificationToUserId as mentioned above. I am using this action in another module, however I'm thinking that shouldn't be a problem, as I'm providing the UserId that I'm signing in to the app with. Some likely causes would be:

- RegisterWithUser needs to be in a login flow like the one specified in the docs

- SendPushNotificationToUserId can't be in another module

Could someone confirm wether any of these restrictions apply, or if you know any other probable cause?

Thanks in advance!

2021-11-29 08-42-47
Johan Åström
Solution

In case someone else runs into this:

In my case the solution was setting the "AsyncRegistration" property of the RegisterWithUser action to false.

Also, I had set the Message/Lang property of the SendPushNotificationToUserId action to "se" for Swedish, which should work according to the OneSignal documentation - however, it only worked when setting this property to "en".

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.