Search code examples
androidpush-notificationfirebasefirebase-cloud-messagingfirebase-notifications

What URL should I use?


I wrote an app some time ago, and now I need to use push notifications. I used Firebase to receive notifications; so far, so good.

Now, I need the admin version of my app to be able to create those notifications, instead of sending them via the console. This documentation says that I should create a POSTrequest, but it doesn't explain what URL I sould POST to.

What is the URL to use?


Solution

  • Take a look at:

    Sending downstream messages

    POST REQUEST:

    https://fcm.googleapis.com/fcm/send
    Content-Type:application/json
    Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
    
    { "data": {
        "score": "5x1",
        "time": "15:10"
      },
      "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..."
    }
    

    to is the device key. Autorization header is your FCM key.