Google Firebase Cloud Messaging migration using REST API and the Azure portal
Article
This article describes the core capabilities for the integration of Azure Notification Hubs with Firebase Cloud Messaging (FCM) v1. As a reminder, Google will stop supporting FCM legacy HTTP on June 20, 2024, so you must migrate your applications and notification payloads to the new format before then. All methods of onboarding will be ready for migration by March 1, 2024.
Important
As of June 2024, FCM legacy APIs will no longer be supported and will be retired. To avoid any disruption in your push notification service, you must migrate to the FCM v1 protocol as soon as possible.
Concepts for FCM v1
A new platform type is supported, called FCM v1.
New APIs, credentials, registrations, and installations are used for FCM v1.
Note
The existing FCM platform is referred to as FCM legacy in this article.
Migration steps
The Firebase Cloud Messaging (FCM) legacy API will be deprecated by July 2024. You can begin migrating from the legacy HTTP protocol to FCM v1 on March 1, 2024. You must complete the migration by June 2024. This section describes the steps to migrate from FCM legacy to FCM v1 using the Notification Hubs REST API.
REST API
The following section describes how to perform the migration using the REST API.
Step 1: Add FCM v1 credentials to hub
The first step is to add credentials via the Azure portal, a management-plane hub operation, or data-plane hub operation.
Create Google service account JSON file
In the Firebase console, select your project and go to Project settings.
Select the Service accounts tab, create a service account, and generate a private key from your Google service account.
Select Generate new private key to generate a JSON file. Download and open the file. Replace the values for project_id, private_key, and client_email, as these are required for Azure Notification Hubs hub credential updates.
OR
If you want to create a service account with customized access permission, you can create a service account through the IAM & Admin > Service Accounts page. Go to the page directly by clicking Manage service account permissions. You can create a service account that has one of the following roles:
Firebase Admin (roles/firebase.admin)
Firebase Grow Admin (roles/firebase.growthAdmin)
Firebase Admin SDK Administrator Service Agent (roles/firebase.sdkAdminServiceAgent)
Firebase SDK Provisioning Service Agent (roles/firebase.sdkProvisioningServiceAgent)
Option 1: Update FcmV1 credentials via the Azure portal
Go to your notification hub on the Azure portal, and select Settings > Google (FCM v1). Get the Private Key, Project ID, and Client Email values from the service account JSON file acquired from the previous section, and save them for later use.
Option 2: Update FcmV1 credentials via management plane hub operation
For direct send scenarios, proceed directly to step 3. If you're using one of the Azure SDKs, see the SDKs article.
Option 1: Create FCM v1 registration or update GCM registration to FCM v1
If you have an existing GCM registration, update the registration to FcmV1Registration. See Create or update a registration. If you don't have an existing GcmRegistration, create a new registration as FcmV1Registration. See Create a registration. The registration request body should appear as in the following example:
Test a payload with the following structure via debug send. Note that FcmV1 introduces a significant change in the structuring of the JSON message payload:
The entire payload moved under a message object.
Android-specific options moved to the Android object and time_to_live is now ttl with a string value.
The data field now allows only a flat string-to-string mapping.