Sending Remote Notification

 

Sends remote notifications to users.
 

How to use Remote Notification API
For more details on how to use the Remote Notification API, please refer to the following pages.
ngCore SDK | Native SDK | Unity SDK

URI Fragment

/remote_notification/@app/{groupId}
/remote_notification/@app/@all/{recipientId}

Parameter NameTypeDescription
groupIdString

Either @all, @android or @ios can be used.

When no recipientId is specified in the request body:
@all: Send a broadcast notification to all of the app's users.
@android: Send a broadcast notification to all of the app's Android users. _
@ios: Send a broadcast notification to all of the app's iOS users

When recipientId is specified in the request body:
@all: Send a broadcast notification to specified users.
@android: Send a broadcast notification to specified users who are on Android.
@ios: Send a broadcast notification to specified users who are on iOS.

recipientId

User ID

Mobage user ID to which remote notification is sent to. Only one user can be specified.

Supported Signing Methods

Client Only Signing, 3-legged Authorization Signing

3-legged Authorization Signing cannot be used with broadcast notifications (@all, @android, @ios).

Please refer here for the details of authentication flow and here for how to sign request to generate the Authorization header.

HTTP Method

POST

Request Header

  • The Authorization header is necessary for this call to succeed.
  • Content-Type: application/json; charset=utf-8

URL Query Parameters

None.

Request Body

A JSON string with the following keys and values. Please refer to the examples below for the actual JSON string.

NameTypeDescriptionRequired
recipientIdUserId ArrayAn array of user ID to whom remote notification is sent to. A maximum of 1000 users can be specified.
Used together with @all, @android and @ios. 
No
payloadObjectAdditional parameters passed to the device.Yes
payload.messageStringA UTF-8 formatted string that forms the body of the message.Yes
payload.badgeIntegerThis number determines the badge used for notifications sent to iOS devices. If no badge is included, no numeric badge is sent. This field has no effect for Android target devices and does not count toward payload size constraints.No
payload.soundStringThe name of the sound in the application bundle to play for notifications on iOS devices. Plays the default sound when the specified sound file is not found or when the value is default. This field has no effect for Android target devices and does not count toward payload size constraints.No
payload.collapseKeyStringThe collapse key to combine multiple messages on an Android device into a single group, displaying the most recent notification only. When no key is specified, all notifications use the same collapseKey. This field has no effect for iOS target devices and does not count toward payload size constraints.No
payload.styleStringA hint that contains the preferred layout style for the system notification tray on Android devices. If no style is given or the provided style is not available, the default Mobage style will be used.  Valid styles are normal and largeIcon. This field has no effect for iOS target devices and does not count toward payload size constraints.No
payload.iconUrlStringThe icon URL that determines the image shown in the notification bar for Android devices for notification payloads that include a style attribute. If this field is not specified, the default Mobage icon image is shown. This field has no effect for iOS target devices and does not count toward payload size constraints.No
payload.extrasObjectCustom 1 level hash of key/value parameters defined by the developer. The string key for each item in this section cannot contain any of the payload's defined key values.No

The combined size of all the serialized parameters of the payload object, excluding recipientId, cannot exceed 256 bytes.

Response Status Code

HTTP Status Code

HTTP Status Message

Meaning

201

Created

Data successfully created.

202

Accepted

Request was accepted for processing.

400

Bad Request

Corrupt request data on the client side

401

Unauthorized

Authorization error

403

Forbidden

The resource exists, but access is not possible due to a reason other than an authorization error.

404

Not Found

The resource does not exist.

429

Too Many Requests

Your app server is sending too many similar requests within a fixed period of time.
For Game-to-All-User remote notification, you can only send one notification per hour.

500

Internal Server Error

An error on the API server side

503

Service Unavailable

The API cannot be used temporarily

Response Body

  • A JSON string about the result of sending remote notification request, can be empty.
  • Content-Type: application/json; charset=utf-8

Example Request & Response

Sending broadcast notifications to all users (Client Only Signing)
Base String
HTTP Request
HTTP Response
Sending broadcast notifications to a group of users (Client Only Signing)
Base String
HTTP Request
HTTP Response
Sending game-to-user notification to a single user (Client Only Signing)
Base String
HTTP Request
HTTP Response
Sending user-to-user notification to a single user (3-legged Authorization Signing)
Base String
HTTP Request
HTTP Response

PREVIOUS

Checking Device Token Registration Status

NEXT

How to use the Remote Notificatio Reservation