Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Nguyen Ngoc · Oct 29, 2020 at 01:22 AM · Push Notifications

Push Notification AdvancedPlatformDelivery IOS,Push Notification IOS AdvancedPlatformDelivery


function pushNotification(PlayFabId) { const applePayload = { "aps": { "alert": { "title": 'Game Request', "subtitle": 'Five Card Draw', "body": 'Do you want to play poker', }, "category": 'GAME_INVITATION' }, "gameID": '01FA1A786' } return server.SendPushNotification({ Recipient: PlayFabId, AdvancedPlatformDelivery: [ { Platform: "ApplePushNotificationService", Json: JSON.stringify(applePayload) } ] }); }

i used this code to push Notification with some Customize Data in CloudScript, but it fail with error message :

"iOS Push Notification Failed: ValidationError 1 validation error detected: Value null at 'message' failed to satisfy constraint: Member must not be null"

,

const applePayload = { "aps": { "alert": { "title": 'Game Request', "subtitle": 'Five Card Draw', "body": 'Do you want to play poker', }, "category": 'GAME_INVITATION' }, "gameID": '01FA1A786' } return server.SendPushNotification({ Recipient: 'E01FA1A786D39B97', AdvancedPlatformDelivery: [ { Platform: "ApplePushNotificationService", Json: JSON.stringify(applePayload) } ] });

=====

I used this code in CloudScript to push a notification (IOS Devices), but it got an error :

"iOS Push Notification Failed: ValidationError 1 validation error detected: Value null at 'message' failed to satisfy constraint: Member must not be null"

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Jay Zuo · Nov 02, 2020 at 09:44 AM

Currently, PlayFab only supports `aps` key. Custom keys and values are not supported. For iOS Push Notification, we will only need to provide the JSON string used as the value of "aps" key in the "Json" part of "AdvancedPlatformDelivery". For example:

  "AdvancedPlatformDelivery": [
    {
      "Platform": "ApplePushNotificationService",
      "Json": "{\"alert\":{\"title\":\"Game Request\",\"body\":\"Bob wants to play poker\",\"action-loc-key\":\"PLAY\"},\"badge\":5}"
    }
  ],
  "TargetPlatforms": [
    "ApplePushNotificationService"
  ]

So, in your code, you can try to change the "applePayload" as the following to see if it works.

const applePayload = { "alert": { "title": 'Game Request', "subtitle": 'Five Card Draw', "body": 'Do you want to play poker' }, "category": 'GAME_INVITATION' };

If you do need the custom keys and values, please feel free to post a feature request for it.

Comment
Nguyen Ngoc
Timbola

People who like this

2 Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nguyen Ngoc · Nov 02, 2020 at 09:51 AM 0
Share

Thank for your help. It worked !.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Some push notifications failing to send 1 Answer

    Unity Android Push Notification Icon White T.T 1 Answer

    Error (Invalid Parameter: Name Reason) upon transferring push notification keys from dev to live project 1 Answer

    Receive incoming webhooks from zendesk 1 Answer

    How to get the position (rank) of the leaderboard when you reset the leaderboard. And send a notification with rank? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges