Hi,
I am trying to set up push notifications with a title and a message from CloudScript.
Example:
I tried a few different ways, but I wasn’t able to get any of them to work properly.
I tried following the example from the Quickstart docs:
https://docs.microsoft.com/en-us/gaming/playfab/features/engagement/push-notifications/quickstart
server.SendPushNotification({ Recipient :currentPlayerId, Package : {Message :"Message Text",Title:"Title Text"} });
The result seems to be showing a dump of the JSON data in the message.
I tried following these docs:
server.SendPushNotification({ Recipient : currentPlayerId, Subject : "Title Text", Message : "Message Text", });
If I try using the Message and Subject parameters I only receive the message without the title.
I also tried following this forum post and use the AdvancedPlatformDelivery.
var IOSPayload = { "alert" : { "title" : "Title Text", "body" : "Message Text" }, "badge" : 0, "sound" : "default" }; try{ server.SendPushNotification( { Recipient: currentPlayerId, AdvancedPlatformDelivery: [ { Platform:"ApplePushNotificationService", Json: JSON.stringify(IOSPayload) } ], TargetPlatforms: [ "ApplePushNotificationService" ] });
It seems that I am getting the same error as the post:
"errorMessage": "iOS Push Notification Failed: ValidationError 1 validation error detected: Value null at 'message' failed to satisfy constraint: Member must not be null",
Based on the forum responses it appears to be an internal Playfab issue.
Please advise on how I should do this?