Prerequisites
To sync with the Single Push API, make sure to issue an authorization token (API KEY). If you already have the key, request the additional permissions. Refer to HIVE Server API > Notification > Push v4 > Authentication to check how to request and issue the authorization token.
URL
Server | URL |
---|---|
Production | https://notification.withhive.com |
Sandbox | https://sandbox-notification.withhive.com |
Basic Data and Request Variables
Method | POST | ||||
---|---|---|---|---|---|
URL | /push/send | ||||
Division | Field Name | Description | Type | Required | |
Header | Content-Type | application/json;charset=utf-8 | |||
Authorization | bearer {{API KEY}} | ||||
Body | notice | Whether to send announcement notification or not (Default: ‘false’)
Announcement and night-time notifications are the items required to get the user agreement.
|
Boolean | O | |
identifiers | Identifier information (up to 100) Check the identifier structureand example below. | identifier[] | O | ||
game | gameid | Game ID | String | O | |
appids | The list of AppID Nothing is sent if the mapping AppID is invalid. Recommendation
|
String[] | X | ||
enableLocale | Whether to enable the locale of each language or not
|
Boolean | O | ||
payload | single | Request to single field if enableLocale=false Check the Message structure below. |
Message | O | |
defaultLanguage | Set with the value of default language if enableLocale=true . |
String | |||
locale {{LANGUAGE}} | Set with the value of locale field if enableLocale=true` Same data with message information of single field. |
Message | |||
option | Refer to the optional information below. | Option | X |
- identifier Structure
Division Field Name Description Type Required identifier identifier playerId One of four identifiers should be included It prioritizes playerId, vid, uid and did in order. Long O vid uid did - identifier Example
1234567[{"playerId":51234,"vid":11232,"did":1234}] - Message Structure
iostitleTitleStringOfacebooktitleTitle (within 1~30 letters)StringODivision Field Name Description Type Required Message android title Title String O message Message String O messageExpanded Expanded message String O imageUrl Image URL String X ticker Ticker String X summaryText Summerized message String X message Message String O mediaUrl Image path String X body Body (within 10~180 letters) String O media Image URL String O - Option Information
Division Field Name Description Type Required Option badge Digits exposed on app icon when receiving push messages(Default: 1) Integer X overwrite Whether to overwrite Android pushes or not(Default: false) Boolean X collapseKey Key values for overwriting pushes(Numeral string type: “123”) String X engagement User Engagement String X comment Comment String X groupKey The group key value to expose notifications in group when a user receives notifications in iOS or Android OS environment. The notification setting chosen in the device OS is applied by default. For more details about the option, see the following documentation. String X android icon This is the icon image file name exposed when a push notification appears on the user’s device. The image file should be located in /src/main/res/drawable. See here for the supported image file formats. If you want to expose an image on the web instead of an image file, type the image URL in this field instead of an image file name. If this field is left empty, the app icon image will be exposed. String X sound This is the name of the notification sound file to be played when a push notification appears on the user’s device. You can specify a sound source file included in the app bundle, and the sound source file should be located in /src/main/res/raw. If this field is left empty, the system’s default sound file is used. String X ios sound This is the name of the notification sound file to be played when a push notification appears on the user’s device. The sound source file should be located in Library/Sounds of the app container, or it must exist in the main bundle of your app. If this field is left empty, the value is automatically set to “default,” and the system default sound file of the user’s Apple device will be used. String X
Output Result
Division | Field Name | Description |
---|---|---|
Header | Content-Type | application/json;charset=utf-8 |
UUID | {{UUID}} | |
Body | – | Body is empty if success |
Response State Code
Key | Value | Description |
---|---|---|
200 | Success | (Body is empty.) |
400 | Bad Request | POST data is omitted.JSON format errorRequired element is omitted or invalid. |
401 | Unauthorized | Authorization header in request message is omitted or invalid.Authorization key (API KEY) is not registered.No access permission to the relevant API |
403 | Forbidden | Authentication scheme of Authorization header is not “Bearer”. (Supported Bearer only) |
404 | Not Found | Request URL is wrong. |
500 | Internal Server Error | Internal error on server |
502 | Bad Gateway | Push gateway server is overloaded.Network connects in a wrong way. |
503 | Service Unavailable | API server or authentication server is frozen. |
Sample Code
-
- Call (“enableLocale“:false)
12345curl -L -v> -d '{"notice":false,"identifiers":[{"vid":19239,"did":300010915}],"game":{"gameid":"com.com2us.hivesdk","appids":["com.com2us.hivesdk.normal.freefull.google.global.android.common"]},"enableLocale":false,"payload":{"single":{"android":{"title":"TEST","message":"TEST","messageExpanded":"","imageUrl":"","ticker":"","summaryText":""},"ios":{"title":"","message":"","mediaUrl":""},"facebook":{"title":"TEST", "body":"TEST MESSAGE BODY", "media": "https://image.newdaily.co.kr/site/data/img/2022/05/13/2022051300019_0.jpg"}},"option":{"badge":"1","overwrite":false,"collapseKey":"","engagement":"","groupKey": "", "android":{"icon":"","sound":""},"ios":{"sound":""}}}}'> -H "Content-Type: application/json"> -H "Authorization: Bearer {API KEY}"> https://sandbox-notification.qpyou.cn/push/send - Call (“enableLocale“:true)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364{"notice": false,"identifiers": [{"playerId": 30000028045}],"game": {"gameid": "com.com2us.hivesdk","appids": ["com.com2us.hivesdk.normal.freefull.google.global.android.common","com.com2us.hivesdk.normal.freefull.apple.global.ios.universal"]},"enableLocale": true,"payload": {"defaultLanguage": "en","locale": {"ko": {"android": {"title": "test_Korean_title","message": "test_Korean_message"},"ios": {"title": "test_Korean_title","message": "test_Korean_message"},"facebook": {"title": "test_Korean_title","body": "test_Korean_message","media": "https://image.newdaily.co.kr/site/data/img/2022/05/13/2022051300019_0.jpg"}},"en": {"android": {"title": "test_English title","message": "test_English message"},"ios": {"title": "test_English title","message": "test_English message"},"facebook": {"title": "test_English title","body": "test_English message","media": "https://image.newdaily.co.kr/site/data/img/2022/05/13/2022051300019_0.jpg"}}},"option": {"badge": 1,"overwrite": true,"collapseKey": "99","groupKey: "","android": {"icon": "GoogleIcon","sound": "GoogleSound"},"ios": {"sound": "AppleSound"}}}}
- Call (“enableLocale“:false)
- Request
1234567> POST /push/send HTTP/1.1> User-Agent: curl/7.29.0> Host: sandbox-notification.qpyou.cn> Accept: */*> Content-Type: application/json> Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDE1NzMyOTcsImp0aSI6ImFkbWluaXN0cmF0b3IifQ.23nG9RnbuOwnMbRSebBi2i-Qt_fOfqU_vUKUZ2JJlWU> Content-Length: 502 - Response
1234< HTTP/1.1 200 OK< content-length: 0< Content-Type: application/json< UUID: 3bc6b414-e2df-40d6-8006-9d2308a6edf9