다음을 통해 공유


Account Management - Send Push Notification

Sends an iOS/Android Push Notification to a specific user, if that user's device has been configured for Push Notifications in PlayFab. If a user has linked both Android and iOS devices, both will be notified.

POST https://titleId.playfabapi.com/Server/SendPushNotification

Request Header

Name Required Type Description
X-SecretKey True

string

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Request Body

Name Required Type Description
Recipient True

string

PlayFabId of the recipient of the push notification.

AdvancedPlatformDelivery

AdvancedPushPlatformMsg[]

Allows you to provide precisely formatted json to target devices. This is an advanced feature, allowing you to deliver to custom plugin logic, fields, or functionality not natively supported by PlayFab.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Message

string

Text of message to send.

Package

PushNotificationPackage

Defines all possible push attributes like message, title, icon, etc. Some parameters are device specific - please see the PushNotificationPackage documentation for details.

Subject

string

Subject of message to send (may not be displayed in all platforms)

TargetPlatforms

PushNotificationPlatform[]

Target Platforms that should receive the Message or Package. If omitted, we will send to all available platforms.

Responses

Name Type Description
200 OK

SendPushNotificationResult

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-SecretKey

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Type: apiKey
In: header

Definitions

Name Description
AdvancedPushPlatformMsg
ApiErrorWrapper

The basic wrapper around every failed API response

PushNotificationPackage
PushNotificationPlatform
SendPushNotificationRequest
SendPushNotificationResult

AdvancedPushPlatformMsg

Name Type Description
GCMDataOnly

boolean

Stops GoogleCloudMessaging notifications from including both notification and data properties and instead only sends the data property.

Json

string

The Json the platform should receive.

Platform

PushNotificationPlatform

The platform that should receive the Json.

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

PushNotificationPackage

Name Type Description
Badge

number

Numerical badge to display on App icon (iOS only)

CustomData

string

This must be a JSON formatted object. For use with developer-created custom Push Notification plugins

Icon

string

Icon file to display with the message (Not supported for iOS)

Message

string

Content of the message (all platforms)

Sound

string

Sound file to play with the message (all platforms)

Title

string

Title/Subject of the message. Not supported for iOS

PushNotificationPlatform

Name Type Description
ApplePushNotificationService

string

GoogleCloudMessaging

string

SendPushNotificationRequest

Name Type Description
AdvancedPlatformDelivery

AdvancedPushPlatformMsg[]

Allows you to provide precisely formatted json to target devices. This is an advanced feature, allowing you to deliver to custom plugin logic, fields, or functionality not natively supported by PlayFab.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Message

string

Text of message to send.

Package

PushNotificationPackage

Defines all possible push attributes like message, title, icon, etc. Some parameters are device specific - please see the PushNotificationPackage documentation for details.

Recipient

string

PlayFabId of the recipient of the push notification.

Subject

string

Subject of message to send (may not be displayed in all platforms)

TargetPlatforms

PushNotificationPlatform[]

Target Platforms that should receive the Message or Package. If omitted, we will send to all available platforms.

SendPushNotificationResult

Error Codes

Name Code
PushNotEnabledForAccount 1094
PushServiceError 1095