Logo Site EngageLab Mark Colored TransparentDocument
Search

Group Push API

Feature Description

This API is used to create push notifications for an application group. With a single call, messages can be pushed to all applications in the group.

  • The override_msg_id attribute in option is not currently supported.
  • Group push supports scheduled tasks only when messages are sent from the console. Setting scheduled tasks by calling the Schedule API is not supported.

Call Verification

Add the following field (key/value pair) to the HTTP header:

Authorization: Basic ${base64_auth_string}
              
              Authorization: Basic ${base64_auth_string}

            
This code block in the floating window

In other words, the base64_auth_string above is generated using the following algorithm: base64(username:password).

The header name is Authorization, and the value is the Base64-encoded username:password pair (with a colon in the middle).

In the Group Push API scenario, username is the group- prefix plus the GroupKey, and password is the Group Master Secret. Both can be viewed in the console under Group Management > Edit.

image.png

Request URL

POST v4/grouppush
              
              POST v4/grouppush

            
This code block in the floating window

Request Example

curl --insecure -X POST -v https://pushapi-sgp.engagelab.com/v4/grouppush -H "Content-Type: application/json" -u "c96f42e0d2e662e45d035ab1:df4d59e84eac2f9d53b36f12" -d '{ "from": "push", "to": "all", "body": { "platform": "all", "notification": { "android": { "alert": "Hi, Push!", "title": "Send to Android", "builder_id": 1, "extras": { "newsid": 321 } }, "ios": { "alert": "Hi, MTPush!", "sound": "default", "badge": "+1", "extras": { "newsid": 321 } }, "hmos": { "alert": "Hi, MTPush!", "title": "", "category": "", "intent": {"url": ""}, "badge_add_num": 1, "test_message": true, "receipt_id": "", "extras": {}, "style": 0, "inbox_content": [], "push_type": 0, "extra_data": "", "display_foreground": "" } } }, "options": { "time_to_live": 60, "apns_production": false }, "request_id": "12345678", "custom_args": "business info" }' > POST /v4/grouppush HTTP/1.1 > Authorization: Basic Yzk2ZjQyZTBkMmU2NjJlNDVkMDM1YWIxOmRmNGQ1OWU4NGVhYzJmOWQ1M2IzNmYxMg==
              
              curl --insecure -X POST -v https://pushapi-sgp.engagelab.com/v4/grouppush -H "Content-Type: application/json" -u "c96f42e0d2e662e45d035ab1:df4d59e84eac2f9d53b36f12" -d 
'{
    "from": "push",
    "to": "all",
    "body": {
        "platform": "all",
        "notification": {
            "android": {
                "alert": "Hi, Push!",
                "title": "Send to Android",
                "builder_id": 1,
                "extras": {
                    "newsid": 321
                }
            },
            "ios": {
                "alert": "Hi, MTPush!",
                "sound": "default",
                "badge": "+1",
                "extras": {
                    "newsid": 321
                }
            },
            "hmos": {
                "alert": "Hi, MTPush!",
                "title": "",
                "category": "",
                "intent": {"url": ""},
                "badge_add_num": 1,
                "test_message": true,
                "receipt_id": "",
                "extras": {},
                "style": 0,
                "inbox_content": [],
                "push_type": 0,
                "extra_data": "",
                "display_foreground": ""
            }
        }
    },
    "options": {
        "time_to_live": 60,
        "apns_production": false
    },
    "request_id": "12345678",
    "custom_args": "business info"
}'
> POST /v4/grouppush HTTP/1.1
> Authorization: Basic Yzk2ZjQyZTBkMmU2NjJlNDVkMDM1YWIxOmRmNGQ1OWU4NGVhYzJmOWQ1M2IzNmYxMg==

            
This code block in the floating window

Request Parameters

For request parameters, refer to the Create Push API.

Response Example

Successful Response

{ "0c3de43c6a6b68c9f4261b06": {"request_id":"12345678","msg_id":"2460001"}, "35c424abde12f475566ca8af": {"request_id":"12345678","msg_id":"2460001"}, "8f02a4fa717a6235734d92de": {"request_id":"12345678","msg_id":"2460001"}, "group_msgid": "cbou2uum98lps87rtic0" }
              
              {
    "0c3de43c6a6b68c9f4261b06": {"request_id":"12345678","msg_id":"2460001"},
    "35c424abde12f475566ca8af": {"request_id":"12345678","msg_id":"2460001"},
    "8f02a4fa717a6235734d92de": {"request_id":"12345678","msg_id":"2460001"},
    "group_msgid": "cbou2uum98lps87rtic0"
}

            
This code block in the floating window

Failed Response

{ "error": { "code": 21037, "message": "group_key is not a 24-character string or does not exist" } }
              
              {
    "error": {
        "code": 21037,
        "message": "group_key is not a 24-character string or does not exist"
    }
}

            
This code block in the floating window

Error Codes

For details, refer to Create Push API - Call Response.

Icon Solid Transparent White Qiyu
Contact Sales