388
Views
5
Comments
Notification RawPayload
Question

Im trying to use the RawPayload from the notification, however the behavior in iOS is different from android.


For the android it displays the raw text json as shown on the screenshot below


but for the the iOS it returns object and not the raw json text shown on the image below


What I need is to get the raw json text just like in android. hoping for this to be answered the soonest :)


Thank you,


Pedro Sousa
Rank: #0

Hello Royce,

From what I could gather, this is most probably due to the underlying differences between the Android Native SDK and iOS Native SDK from OneSignal itself. 

While on Android the rawPayload property of the OSNotificationPayload class is a string, which maps directly to the OutSystems structure attribute of type Text, on the iOS the same property of the OSNotificationPayload class has the type NSDictionary, which doesn't map directly to a Text attribute (hence the "[object Object]").

Either the OutSystems OneSignal Plugin adds some processing to handle the iOS case differently from the Android one, or this OneSignal SDK difference will prevent you from using the value in iOS. 

What was your use case for the raw payload? Can you handle it differently without relying on this structure attribute?

Regards,
Pedro

Staff
Rank: #308

Hello, Royce,

At first glance, that looks like a bug. Could you get in touch with us via a support case, so we can have a better look and follow-up if it is indeed the case?

In the meantime, maybe you could try using a JS node and use the typeof function to determine if rawPayload is a string or an object? And if the latter, use "JSON.stringify" to convert the Object into a string, matching the expected type?

Best regards,

Carlos Simões

Rank: #35102

Hello everyone, 

I'm in this situation right now, 'cause I want to send some arbitrary data along with the notification

as of current version of OneSignal plugin, it appears that RawPayload is already in type Text

but how can i see what properties in that parsed RawPayload?

have been looking around and there's not much documentation about this

thank you

Rank: #26485

Hello Guys,

I was facing this problem and i was able to resolve, it's not a problem of the plugin itself, but it's a problem when platform tries to convert the json in a structure. see below:


I made a simple solution creating a JavaScript that transform a string into a json object and then get the "additionalData" inside of payload, with this value i just added one output parameter with this string.


After all this things done when the event of this block (OneSignal) will trigger you will be able to use the aditional data in the payload.


Plataform version: 10.0.1016.0 ,

Service Studi: 10.0.1018.0,

Plugin Version:  3.1.0 


Best Regards,

Geuvan Júnior.