I've been working on custom payloads in notifications to support deep linking from push notifications. I was using an "advanced" notification template for easy testing. Once I got all the deep linking working with the app, I figured I would quickly add the code in a cloud script... Unfortunately, the AdvancedPlatformDelivery behaves differently than the advanced notification templates! The same issue was reported here: https://community.playfab.com/questions/28199/getting-custom-data-from-push-notifications-via-re.html
Basically, the following advanced notification iOS payload works great with advanced notification template:
{ "aps": { "alert": { "title": "Bob invited you to a game!", "body": "invitation to play" }, "sound": "default" }, "data": { "deepLink": "some deep link" } }
Notice that, as per requirements for iOS, my custom "data" field I added is outside the "aps" node. This JSON works great in advanced templates. Now, using SendPushNotification with AdvancedPushPlatformMsg with the "Json" set to the exact same JSON, the following shows up in the sent_push_notification telemetry:
"aps": { "aps": { "alert": { "title": "Bob invited you to a game!", "body": "invitation to play" }, "sound": "default" }, "data": { "deepLink": "some deep link" } } }
Clearly this is invalid - and indeed the push notification never arrives on my phone. The API seems to be wrapping my whole advanced JSON inside a hard-coded "aps" node. I can make the notification work by just sending the contents inside MY aps node (I confirmed that sends a notification), but that means I cannot send my custom "data" node, which is the whole purpose of using advanced.
I realize that fixing this is a breaking change. But at this point, it's impossible to send custom payload data to iOS. Perhaps a new API or a new optional field to the advanced notifications API request would unblock this scenario? Perhaps a flag to indicate that aps is included in the JSON and doesn't have to be added by the API?
I can't use templates because there is no way to pass in parameters to customize the message, is there?