firebase Firebase Cloud Messaging HTTP Protocol


Example

From your server request to the the link below to send the notification with some request parameters

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

While requesting add headers as follows

Authorization    key=<Your_key_from_the_console>
Content-Type     application/json

The body of the request varies

{
  "to" : <tokens or the topic>,
  "notification" : {
    "title":"This is a test title",
    "body":"This is the body"
  },
  "data": {
      //whatever key value payer you need to send  
  }
}

The to parameters takes Array of tokens like

["token1","token2",..........]

or a single token like

"token"

or a topic name starting with /topic/ like

"/topic_name/"

For multiple topic use conditions using || and && operators like

"/topic_name/ && /topic2/"