Logo Site EngageLab Mark Colored TransparentDokumen
Cari

API Push Grup

Ringkasan Fitur

API ini digunakan untuk membuat push untuk grup aplikasi. Dengan satu panggilan, pesan dapat dikirim ke semua aplikasi dalam grup.

  • Properti override_msg_id dalam option saat ini belum didukung.
  • Untuk push grup, tugas terjadwal hanya dapat dikonfigurasi saat melakukan push dari konsol. Pengaturan tugas terjadwal melalui Schedule API tidak didukung.

Autentikasi

Tambahkan pasangan key/value berikut ke header HTTP:

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

            
Tampilkan blok kode ini di jendela mengambang

Algoritme untuk membuat base64_auth_string di atas adalah: base64(username:password)
Nama header adalah Authorization, dan nilainya adalah pasangan username:password yang telah dikonversi ke Base64 (dengan tanda titik dua di antaranya).
Dalam skenario Group Push API, username adalah prefiks group- yang ditambahkan ke GroupKey, dan password adalah Group Master Secret. Keduanya dapat dilihat di konsol pada [Group Management] - [Edit].

image.png

Endpoint

POST v4/grouppush
              
              POST v4/grouppush

            
Tampilkan blok kode ini di jendela mengambang

Contoh Permintaan

curl --insecure -X POST -v https://webpushapi-sgp.engagelab.com/v4/grouppush \ -H "Content-Type: application/json" \ -u "c96f42e0d2e662e45d035ab1:df4d59e84eac2f9d53b36f12" \ -d '{ "from": "push", "to": "all", "body": { "platform": "web", "notification": { "alert": "Hi,MTPush !", "web": { "title": "web_push", "url": "http://www.google.com", "extras": { "web-key1": "web-value1" } } } }, "request_id": "12345678", "custom_args": "business info" }' > POST /v4/grouppush HTTP/1.1 > Authorization: Basic Yzk2ZjQyZTBkMmU2NjJlNDVkMDM1YWIxOmRmNGQ1OWU4NGVhYzJmOWQ1M2IzNmYxMg==
              
              curl --insecure -X POST -v https://webpushapi-sgp.engagelab.com/v4/grouppush \
-H "Content-Type: application/json" \
-u "c96f42e0d2e662e45d035ab1:df4d59e84eac2f9d53b36f12" \
-d '{
    "from": "push",
    "to": "all",
    "body": {
        "platform": "web",
        "notification": {
            "alert": "Hi,MTPush !",
            "web": {
                "title": "web_push",
                "url": "http://www.google.com",
                "extras": {
                    "web-key1": "web-value1"
                }
            }
        }
    },
    "request_id": "12345678",
    "custom_args": "business info"
}'
> POST /v4/grouppush HTTP/1.1
> Authorization: Basic Yzk2ZjQyZTBkMmU2NjJlNDVkMDM1YWIxOmRmNGQ1OWU4NGVhYzJmOWQ1M2IzNmYxMg==

            
Tampilkan blok kode ini di jendela mengambang

Parameter Permintaan

Untuk parameter permintaan, lihat Create Push API.

Contoh Respons

Respons Berhasil

{ "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"
}

            
Tampilkan blok kode ini di jendela mengambang

Respons Gagal

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

            
Tampilkan blok kode ini di jendela mengambang

Kode Error

Untuk detailnya, lihat "Create Push API - Response".

Icon Solid Transparent White Qiyu
Hubungi Sales