firebase fcm send message curl code example

Example 1: fcm post example curl

curl -X POST -H "Authorization: Bearer ya29.ElqKBGN2Ri_Uz...HnS_uNreA" -H "Content-Type: application/json" -d '{
  "message": {
    "topic" : "foo-bar",
    "notification": {
      "body": "This is a Firebase Cloud Messaging Topic Message!",
      "title": "FCM Message"
    }
  }
}' https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send HTTP/1.1

Example 2: curl tring for send message firebasde

curl -X POST -H "Authorization: Bearer YOUR-TOKEN" -H "Content-Type: application/json" -d '{
  "message":{
    "token":"TARGET_DEVICE_TOKEN",
    "notification":{
      "title":"Hello",
      "body":"This is a text message!"
    }
  }
}' https://fcm.googleapis.com/v1/projects/YOUR-PROJECT-SHORT-NAME/messages:send