Skip to content

PUSH-notifications🔗

Study the “General Information” and the “Signature Verification” sections first.

For more information on what PUSH-notifications are, see the Notifications section.

Sends PUSH-notifications to the user device.

Parameters🔗

Parameter Method Value Mandatory Type Description
action GET push yes string Command
deviceId GET, POST 7a094faa...6064730c4 no string Device IDs separated by semicolons.
userId GET, POST 87bdfdc4...e75fdf2e0 no string User IDs separated by semicolons.
title GET, POST Game news no string Notification title.
msg GET, POST Your garden bed is withered no string Notification text.
param GET, POST 1 no number 1 - Send to all user devices. 2 - Send to the last active available device. (Only when sending UserID)
badge GET, POST 1 no number The number on top of the application icon.
stime GET, POST 1406110217 no number PUSH-notification send time (by default, notifications are sent as soon as possible).
sound GET, POST default no string Alert sound.
json_params GET, POST {} no string Json-array of parameters which can be sent to the client.
timezone GET, POST 0 no number 0 - do not take into account user's time zone, 1 - take into account user's time zone.
debug GET, POST 0 no number 0 - Production, 1 - develop.
channelid GET, POST test_1 no string Channel Id. Learn more about channels and channel groups
channelname GET, POST Test 1 no string Channel name. Learn more about channels and channel groups
channelgroupid GET, POST test_1 no string Group Id. Learn more about channels and channel groups
channelgroupname GET, POST Test 1 no string Group name. Learn more about channels and channel groups

Error codes🔗

Code Description
-54 Unexpected error. Contact technical specialists.
-55 No user/device ID is set.
-56 No devices are linked to the user.
-57 No tokens were found for the selected user/device.

Request example🔗

https://mrgs.astrum.team/pub/s2s.php?action=push&appId=67&deviceId=176491cae972fe898f9f1744f397c434&format=json&msg=%D0%A1%D0%B6%D0%B5%D1%87%D1%8C+%D0%BF%D0%BE%D1%81%D0%BB%D0%B5+%D0%BF%D1%80%D0%BE%D1%87%D1%82%D0%B5%D0%BD%D0%B8%D1%8F%21%0D%0ATest+push

Response example🔗

{
    "status":0,
    "error":"",
    "result":[]
}

Custom push-notifications (Android)🔗

To customize notifications, it is enough to pass the following parameters to json_params

{
  "icon": "notification_icon_small",
  "largeIcon": "notification_icon_large",
  "custom_notification": {
    "layout": "layout_notification_halloween",
    "images": {
      "image_view1": "castle",
      "image_view2": "background"
    },
    "texts": {
      "notification_text1": "Sorry",
      "notification_text2": "But your princess is in another castle!"
    }
  }
}

"icon" - the name of the file (without extension) in the drawable resources that will be used to set the small icon push notifications.
"largeIcon" - the name of the file (without extension) in the drawable resources that will be used to display the large icon push notifications.

"custom_notification" - a structure with a description of a custom push notification, if you want to show a push notification with a specific layout.
"layout" - the name of the file (without extension) in the layout resources that will be used to display a custom push notification.
"images" - a structure with a description of all view:android:id(keys) and the names of drawable files(values). The example from the snippet above, where image_view1 is the view id <ImageView android:id="@+id/image_view1" .../> which is placed in layout layout_notification_halloween.xml, where castle is the name of the file in drawable resources to be displayed in <ImageView .../>.
"texts" - a structure with a description of all view:android:id(keys) and text(values). The example from the snippet above, where notification_text1 is the view id <TextView android:id="@+id/notification_text1" .../> which is placed in layout layout_notification_halloween.xml.

Expanded and collapsed custom push notifications views🔗

To style custom notifications, just pass the following parameters to json_params

  • In order to insert a big picture into an expanded notification:
{
    "style": 2,
    "icon": "push_icon",
    "largeIcon": "push_icon_large",
    "expandable_notification": {
        "big_picture": "logo"
    }
}

"style" - style of the extended notification, set in numbers, value 2 - corresponds to the NotificationCompat.BigPictureStyle style in Android. "icon" - file name (without extension) in drawable resources that will be used to display small icon push notifications. "largeIcon" - file name (without extension) in drawable resources that will be used to display the large icon push notifications, this icon will be displayed for push notifications in a minimized state.

"expandable_notification" - a structure describing an expanded custom push notification, if you want to show a push notification with different styles or specific layout. "big_picture" - file name (without extension) in drawable resources, big_image which will be shown in the expanded notification .

  • To display expanded and collapsed push notifications , just pass the following parameters to json params
{
    "style": 3,
    "icon": "push_icon",
    "largeIcon": "push_icon_large",
    "expandable_notification": {
        "big_picture": "logo",
         "collapsed": {
            "message": "Nuclear weapon is ready!",
            "layout": "custom_notification_collapsed",
            "title_view": "title_notification",
            "text_view": "text_notification",
            "images": {
                "img_notification_background": "ic_notification",
                "img_notification_icon": "push_icon"
            }
        },
        "expanded": {
            "message": "Nuclear weapons are ready! But be careful when using it, since your combat units may also be harmed when used.",
            "layout": "custom_notification_expanded",
            "title_view": "title_notification",
            "text_view": "text_notification",
            "images": {
               "img_notification_background": "ic_notification",
               "img_notification_icon": "push_icon_large"
            }
        }
    }
}

"style" - style of the extended notification, set in numbers, value 3 - corresponds to the NotificationCompat.DecoratedCustomViewStyle style in Android "icon" - file name (without extension) in drawable resources that will be used to display small icon push notifications. "largeIcon" - file name (without extension) in drawable resources that will be used to display the large icon push notifications, this icon will be displayed for push notifications in a minimized state.

"expandable_notification" - a structure describing an expanded custom push notification, if you want to show a push notification with different styles or specific layout.

"collapsed" - structure with a description for displaying a push notification in a collapsed state. "collapsed_message" - message text for push notification. "collapsed_layout" - file name (without extension) in layout resources that will be used to display a collapsed push notification. "title_view" - identifier for the title field in collapsed_layout (view:android:id). "text_view" - identifier for the message text field in collapsed_layout (view:android:id). "images" - a structure with a description of all views: android:id (keys) specified in collapsed_layout, and the names of the drawable files (values).

"expanded" - a structure with a description for displaying a push notification in an expanded state. "expanded_message" - message text for push notifications in expanded state. "expanded_layout" file name (without extension) in layout resources that will be used to display the expanded push notification. "title_view" - identifier for the title field in expanded_layout (view:android:id). "text_view" - identifier for the message text field in expanded_layout (view:android:id). "images" - a structure with a description of all views: android:id (keys) specified in expanded_layout, and the names of drawable files (values).

Default style parameter

The style parameter by default to the NotificationCompat.BigTextStyle style, this style is more suitable only for expanded notification views

Custom push notifications (iOS)🔗

To send a notification with a category (custom interface or notification with buttons), you first need to register this category on the client (read the SDK integration documentation).

Then, to send a push notification with the selected category, you need to:

  • When sending S2S (either of the two options below)
    1. Add the desired category to the channelgroupid field (described above)
    2. In the json_params field (described above), add json, which will contain the aps_category key with the identifier of the desired category at the root. (for example - {"data1": "someAppData", "aps_category":"<CategoryId>"})
  • When submitting via the MRGS website (either of the two options below)
    1. Add the desired category in the "Channel ID" field
    2. In the Additional parameters field, add json, which will contain the aps_category key with the identifier of the desired category at the root. (for example - {"data1": "someAppData", "aps_category":"<CategoryId>"})

Last update: 2025-01-21
Created: 2020-02-17