[OneSignal Plugin] Register and Set Tags (issues with the component)

[OneSignal Plugin] Register and Set Tags (issues with the component)

  
Forge Component
(7)
Published on 4 Jul by OutSystems R&D
7 votes
Published on 4 Jul by OutSystems R&D

Hi team,

I've noticed that setting tags after device registration (RegisterWithUser) doesn't always work. After troubleshooting, I've found a few issues:

  1. Why is RegisterWithUser always re-applying existing tags? If I want to use SetTag after login/registration (for example, depending on the user role), this seems a waste.
    • Suggestion: make it an option (eg add a SetUserTags parameter).
  2. RegisterWithUser.AsyncRegistration doesn't really work, since RegisterUserAsync will always be invoked asynchronously from the JS node. This was causing concurrency issues when trying to set tags after registration.
    • Suggestion: just invoke RegisterUserAsync normally if AsyncRegistration=false, instead using the existing JS.
  3. While unregistering the device (and tags were set), I was getting an API error. Reason: malformed JSON. This happened when clearing tags (Key, ""), since the empty value was not being included in the JSON.
    • Suggestion: OneSignalAPI > Tag structure > Value: change property Send Default Value to Yes.
  4. OneSignalAPI > SetTag > If after LogMessage4: added the condition GetDevice.List.Current.Device.OneSignalPlayerId <> "" and deleted empty Assigns, since this was invoking the API with an empty PlayerId, which caused an error. This was likely a side-effect of issue 2 above, but still this logic seems to need some rework.


For now I'm using a custom version of the component. Let me know if you need more details / modules.

Also, a question: what do you advise as a best practice when the user logs out of the app? Unregister (which also clears tags) or just DisableSubscription?