Build app server send requests

Using the Firebase Admin SDK or FCM app server protocols, you can build message requests and send them to these types of targets:

  • Topic name
  • Condition
  • Device registration token
  • Device group name (protocol only)

You can send messages with a notification payload made up of predefined fields, a data payload of your own user-defined fields, or a message containing both types of payload. See Message types for more information.

Examples in this page show how to send notification messages using the Firebase Admin SDK (which has support for Node, Java, Python, C#, and Go) and the v1 HTTP protocol.

Send direct boot-enabled messages (Android only)

You can send messages to devices in direct boot mode using the HTTP v1 or legacy HTTP APIs. Before sending to devices in direct boot mode, make sure you have completed the steps to enable client devices to receive FCM messages in direct boot mode.

Send using the FCM v1 HTTP API

The message request must include the key "direct_boot_ok" : true in the AndroidConfig options of the request body. For example:

https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send
Content-Type:application/json
Authorization: Bearer ya29.ElqKBGN2Ri_Uz...HnS_uNreA

{
  "message":{
    "token" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..."
    "data": {
      "score": "5x1",
      "time": "15:10"
    },
    "android": {
      "direct_boot_ok": true,
    },
}