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,
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]").
rawPayload
string
NSDictionary
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
Pedro Sousa wrote:
Hi Pedro,
Thank you for your response, I'm using the rawPayload to extract custom data from the push notification. any recomendation on how should I handle it?
I'm using a POST action on my cms to send the notification with this payloads
{ "app_id": "the-app-id", "included_segments": ["All"], "include_player_ids": ["player-id"], "data":{"refno":"value"}, "url":"https://sample.com/", "contents": {"en": "English sample!"}, "headings":{"en":"This is a title"}, "big_picture": "", "small_icon": "", "isAndroid":false}
I'm trying to extract the refno value from the push notification.
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
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
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.