Cara Mengirimkan Data Notifikasi Firebase Dengan Postman

Selamat pagi teman teman, Saat ini saya akan mau berbagi cara kami mengirimkan sebuah notifikasi melalui postman. Artinya firebase google menyediakan cara agar seseorang bisa mengirimkan sebuah notifikasi dengan melalui api tanpa harus melakukan notifikasi di UI firebasenya. Ini juga bisa digunakan pada bagian proses backend. Lalu bagaimana cara formatnya : 

Url :

https://fcm.googleapis.com/fcm/send

Header

Authorization : key=Key untuk token firebase

Body [ ini adalah body untuk mengirimkan ke 1 device saja ]

{
    "to": "Token Per Device Firebase",
    "notification": {
        "body": "Body of Your Notification Ulum",
        "title": "Title of Your Notification"
    },
    "data": {
        "body": "Body of Your Notification in Data",
        "title": "Title of Your Notification in Title",
        "key_1": "Value for key_1",
        "key_2": "Value for key_2"
    }
}

Body [ ini adalah body untuk mengirimkan ke banyak device menggunakan topic ]

{
    "to": "/topics/nama topics yang di subcribe",
    "collapse_key": "type_a",
    "notification": {
        "body": "Body of Your Notification Ulum",
        "title": "Title of Your Notification"
    },
    "data": {
        "body": "Body of Your Notification in Data",
        "title": "Title of Your Notification in Title",
        "key_1": "Value for key_1",
        "key_2": "Value for key_2"
    }
}

Baik mungkin hanya sesimpel ini yang bisa saya bagikan, apabila ada kekurangan silahkan langsung tanya dikomentar. 

Terimakasih telah membacanya sampai akhir.
Muhammad Miftahul Ulum

MuhammadMiftahulUlum.com is an information blog founded in 2014. This blog shares information from experiences, tips, and tricks, as well as comments from the author's side. I am someone who is always eager to learn new things and share my knowledge of various topics. 

Diberdayakan oleh Blogger.