Stay organized with collections
Save and categorize content based on your preferences.
Your server environment and FCM
The server side of Firebase Cloud Messaging consists of two components:
The FCM backend provided by Google.
Your app server or other trusted server environment where
your server logic runs,
such as Cloud Functions for Firebase or other cloud environments
managed by Google.
Your app server or trusted server environment sends message requests to the FCM
backend, which then routes messages to client apps running on users' devices.
Requirements for the trusted server environment
Your app server environment must meet the following criteria:
Able to send properly formatted message requests to the FCM backend.
Able to securely store server authorization credentials and client registration tokens.
Choosing a server option
You'll need to decide on a way to interact with FCM servers: either using the
Firebase Admin SDK or the raw protocol.
Because of its support across popular programming languages and its convenience methods for
handling authentication and authorization, the Firebase Admin SDK is the recommended method.
Options for interacting with FCM servers include the following:
The Firebase Admin SDK, which has support for
Node,
Java,
Python,
C#,
and
Go.
The Admin FCM API handles authenticating with the backend and facilitates sending
messages and managing topic subscriptions. With the Firebase Admin SDK, you can:
Send messages to individual devices
Send messages to topics and condition statements that match one or more topics.
Subscribe and unsubscribe devices to and from topics
Construct message payloads tailored to different target platforms
The Admin Node.js SDK provides
methods for sending messages to device groups.
FCM provides the FCM HTTP v1 API for developers who prefer a raw server protocol.
To send a message, the app server issues a POST request with
an HTTP header and an HTTP body comprised of JSON key value pairs.
For details on the header and body options, see
Build App Server Send Requests
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[],null,["\u003cbr /\u003e\n\nYour server environment and FCM\n\nThe server side of Firebase Cloud Messaging consists of two components:\n\n- The **FCM backend** provided by Google.\n- Your **app server** or other **trusted server environment** where your server logic runs, such as [Cloud Functions for Firebase](/docs/functions) or other cloud environments managed by Google.\n\n\u003cbr /\u003e\n\nYour app server or trusted server environment sends message requests to the FCM\nbackend, which then routes messages to client apps running on users' devices.\n\nRequirements for the trusted server environment\n\nYour app server environment must meet the following criteria:\n\n- Able to send properly formatted message requests to the FCM backend.\n- Able to handle requests and resend them using [exponential back-off.](https://developers.google.com/api-client-library/java/google-http-java-client/backoff)\n- Able to securely store server authorization credentials and client registration tokens.\n\nChoosing a server option\n\nYou'll need to decide on a way to interact with FCM servers: either using the\n[Firebase Admin SDK](/docs/cloud-messaging/server#firebase-admin-sdk-for-fcm) or the raw protocol.\nBecause of its support across popular programming languages and its convenience methods for\nhandling authentication and authorization, the Firebase Admin SDK is the recommended method.\n\nOptions for interacting with FCM servers include the following:\n\n- The Firebase Admin SDK, which has support for [Node](/docs/reference/admin/node/firebase-admin.messaging), [Java](/docs/reference/admin/java/reference/com/google/firebase/messaging/package-summary), [Python](/docs/reference/admin/python/firebase_admin.messaging), [C#](/docs/reference/admin/dotnet/namespace/firebase-admin/messaging), and [Go](//godoc.org/firebase.google.com/go/messaging).\n- The [FCM HTTP v1 API](/docs/reference/fcm/rest/v1/projects.messages), a REST API with secure authorization and flexible [cross-platform messaging capabilities](/docs/cloud-messaging/send-message#customize_messages_across_platforms) (the Firebase Admin SDK is based on this protocol and provides all of its inherent advantages).\n\nFirebase Admin SDK for FCM\n\nThe Admin FCM API handles authenticating with the backend and facilitates sending\nmessages and managing topic subscriptions. With the Firebase Admin SDK, you can:\n\n- Send messages to individual devices\n- Send messages to topics and condition statements that match one or more topics.\n- Subscribe and unsubscribe devices to and from topics\n- Construct message payloads tailored to different target platforms\n\nThe Admin Node.js SDK provides\nmethods for sending messages to device groups.\n\nTo set up the Firebase Admin SDK, see [Add the\nFirebase Admin SDK to Your Server](/docs/admin/setup). If you already have a Firebase project,\nstart with [Add the SDK](/docs/admin/setup#add-sdk). Also, make sure to enable the\nCloud Messaging API in the\n[Cloud Messaging settings page](//console.firebase.google.com/project/_/settings/cloudmessaging/)\nfor your project. Then, once the Firebase Admin SDK is installed, you can start writing logic to\n[build send requests](/docs/cloud-messaging/send-message).\n| The Firebase Admin SDK provides an API for subscribing and unsubscribing devices to and from FCM topics. These operations can subscribe or unsubscribe up to 1000 device registration tokens at a time. For more information, see [Manage topics from the server](/docs/cloud-messaging/manage-topics).\n\nFCM server protocol\n\nFCM provides the [FCM HTTP v1 API](/docs/reference/fcm/rest/v1/projects.messages) for developers who prefer a raw server protocol.\n\nTo send a message, the app server issues a POST request with\nan HTTP header and an HTTP body comprised of JSON key value pairs.\nFor details on the header and body options, see\n[Build App Server Send Requests](/docs/cloud-messaging/send-message)"]]