question

pingu2k4 avatar image
pingu2k4 asked

Unable to send push notification from cloudscript - "The Recipient field is required."

I have some cloudscript, which is meant to send a push notification to a specified user. It is throwing an error:

"errorDetails": {
                            "Recipient": [
                                "The Recipient field is required."
                            ],
                            "SendPushNotificationRequest": [
                                "One of the following properties must be defined: Message, Package, AdvancedPlatformDelivery"
                            ]
                        }

However, the recipient field is set in the request. Here is my cloudscript code its using:

var pushRequest = {
                Recipient: "Player ID replaced here",
                Message: "Message Body",
                Subject: "Message Title",
            }
            
            var pushResponse = server.SendPushNotification(request);
CloudScriptPush Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pingu2k4 avatar image
pingu2k4 answered

Never mind, im using the wrong request, using a request from another place in my code. my bad. :( I looked for hours, and only after posting I saw >.<

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

laurentiumarianivan avatar image
laurentiumarianivan answered

What is the request someone should use?

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

There's a request class for each request - it's always "{API call}Request", so it would be SendPushNotificationRequest, in this case. That said, in Cloud Script you'd just create it with a standard var call, as above - just make sure that the parameters are correct for the given call.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.