Amr
Amr

Reputation: 57

how to push notification from postman to firebase?

I'm Trying to push notification from postman to firebase for testing I posted using documentation tips and response is success but nothing sent to my android device .. I tested my code using debugging and firebase console and it working well but when i used postman nothing happens

This is my posting format

http://fcm.googleapis.com/fcm/send

Content-Type : application/json
Authorization: key=AAAAitv2sYo:APA91bENlw37p5pa7pMIKoVv8CroevA7tK3tVFNGUchhGf_zkeKVFdQeYcKQmxsg-2ZOkNHMAvloRjTugmZHzNBa_TLMR2_7lffglJvrKHT1TNixHxtXZimWi2f7c16M2M7ic2S5g1gC


 {
   "notification" : 
   {
    "body" : "hello",
    "title": "firebase",
    "sound": "default"
   },
    "to" : "AAAAitv2sYo:APA91bENlw37p5pa7pMIKoVv8CroevA7tK3tVFNGUchhGf_zkeKVFdQeYcKQmxsg-2ZOkNHMAvloRjTugmZHzNBa_TLMR2_7lffglJvrKHT1TNixHxtXZimWi2f7c16M2M7ic2S5g1gC"
}

i used authorization and to is the same key " server key "

and the response is

{
    "multicast_id": 9063339683658826188,
    "success": 1,
    "failure": 0,
    "canonical_ids": 0,
    "results": [
        {
            "message_id": "0:1533133178192931%0000000000000000"
        }
    ]
}

Note : When i write https posting is failed and got Could not get any response error when i made it http it get the above response

another question .. can i see the sent message in firebase console ?

Upvotes: 1

Views: 9929

Answers (1)

Bob Snyder
Bob Snyder

Reputation: 38319

The Authorization key in the header and the to property in the message have different purposes and are never the same value.

The Authorization key validates your request to the Firebase server. Its value is the "Server key" shown in the Cloud Messaging tab of your Project settings at the Firebase console.

The message to value is the registration ID of the device to which you are sending the message. It is obtained from a call to a client-side SDK.

Upvotes: 1

Related Questions