If any of your Iterable projects use Firebase Cloud Messaging (FCM) to send mobile or web push notifications, migrate them to the FCM HTTP v1 API before July 22, 2024 (Google has changed the deadline from June 20 to July 22). On July 22, 2024, Google will start shutting down the legacy FCM API, and Iterable projects that still use it will no longer be able to send mobile or web push notifications.
TIP
This document discusses web push notifications. For information about migrating mobile push notifications to the new FCM HTTP v1 API, read Mobile Push Notifications: Migrating to FCM HTTP v1 API.
# In this article
- Overview
- Step 1: Create a sandbox project in Iterable
-
Step 2: Test web push notifications in your sandbox project
- Step 2.1: Find your website's legacy FCM server API key and sender ID
- Step 2.2: Find a browser token for a test user
- Step 2.3: Create a Firebase service account
- Step 2.4: Create and download a JSON private key for the new FCM API
- Step 2.5: Configure your sandbox project to use your new FCM private keys
- Step 2.6: Send a test message from your sandbox project
- Step 3: Update your production Iterable projects
# Overview
Iterable can use Firebase Cloud Messaging (FCM) to send web push notifications. To do this, it relies on the FCM API. However, Google has deprecated the legacy FCM APIs, and replaced them with the FCM HTTP v1 API. Because of this, you must update any of your Iterable projects that use the legacy FCM APIs.
WARNING
Make these updates before Google starts shut off the legacy FCM APIs on July 22, 2024. Otherwise, you won't be able to continue sending push notifications.
NOTE
To migrate an Iterable project to the new FCM API, you'll need to add a new Firebase private key (JSON) to the project. However, you do not need to update the browser tokens stored on the user profiles in that project. The existing browser tokens will continue to work as expected.
The instructions below describe how to:
- Create a sandbox project in Iterable.
- For each website to which you send web push notifications from Iterable:
- Gather some preliminary information.
- Create a JSON private key for the new FCM API.
- Send a test push notification from your sandbox project.
- Update your production Iterable projects.
If you have any questions, or if you need any help with the steps in this document, contact Iterable support.
# Step 1: Create a sandbox project in Iterable
In this step, you'll create a sandbox project. In subsequent steps, you'll add web push integrations to this project and use them to test your new FCM credentials.
TIP
An Iterable project can only have a single web push integration. If you need to test new FCM credentials for multiple web push integrations, you can either:
- Create multiple sandbox projects, and use each one to test sending web push notifications for a single website.
- Create a single sandbox project, and use it to send test web push notifications to one website at a time, deleting the project's web push integration between each test.
To create a sandbox project:
Sign in to Iterable with a user that has the Create Projects org permission.
-
For Name, provide a name that clearly identifies the project as a sandbox (non-production) project.
For Time zone, select any time zone that makes sense.
For Unique identifier, choose any unique identifier you like (email, userId, or hybrid). When sending test web push notifications, you'll target specific browser tokens, not user identifiers, so your selection here isn't particularly consequential in this case.
Click Create. Iterable creates the new project and switches you to it.
# Step 2: Test web push notifications in your sandbox project
TIP
Complete the steps in this section, through the end of the document, for each website to which you send web push notifications through Iterable and FCM.
For each website that you need to migrate to the new FCM API, the following steps describe how to:
- Gather some preliminary information.
- Find your legacy FCM server API key and sender ID.
- Find a browser token for a test user.
- Create JSON private keys for the new FCM API.
- Use the new JSON private keys to send test messages from a sandbox project.
- Update your production Iterable projects.
# Step 2.1: Find your website's legacy FCM server API key and sender ID
First, find the legacy server API key and sender ID you currently use to send web push notifications to the website under consideration.
If you have trouble upgrading your production Iterable projects to the new FCM API, you can use the FCM server API key to revert to the legacy FCM API — as long as Google hasn't shut it off yet (which will start happening on July 22, 2024).
To find your website's legacy FCM server API key and sender ID:
Sign in to Firebase: https://firebase.google.com
-
Click Go to console.
Click the tile that corresponds to the Firebase project you use for the website in question.
-
Click the settings gear and select Project settings.
Go to the Cloud Messaging tab.
-
In the Cloud Messaging API (Legacy) section, next to Server key, there's a Token value (some projects may have multiple tokens). A token is a legacy FCM server API key — copy one of them and keep it in a safe place, but don't share it with others.
In the Cloud Messaging API (Legacy) section, at the bottom of the table, there's a Sender ID. Copy this value and keep it in a safe place.
# Step 2.2: Find a browser token for a test user
Next, find the browser token for a test user — an internal user to whom you can send a test web push notification, to test your new FCM private key. This should be a user who has visited your website and agreed to receive web push notifications.
Find the
userId
oremail
associated with the Iterable user profile of an internal user who has has agreed to receive web push notifications from your website. This should not be an end user/customer, since you'll be sending a test push notification they'll actually receive.Sign in to Iterable, with a user who has permission to View User Profiles and Data or Create and Manage User Profiles and Data.
Switch to the Iterable project that contains the test user's profile.
Navigate to Audience > User Lookup.
Enter the user's
userId
oremail
and click Search users.On the user's profile, in the navigation menu, select User fields.
-
In the User fields section of the page, twirl open the
browserTokens
array. Copy a value:
# Step 2.3: Create a Firebase service account
TIP
For more information about topics discussed in this section, read Google's documentation: Firebase Service Accounts Overview, Create service accounts and Create and manage custom roles.
Next, create a Firebase service account for the website you're testing, and give it sufficient permission to send web push notifications on your behalf (when you create a private key in the next step, you'll associate it with this Firebase service account):
Sign in to Firebase: https://firebase.google.com
Click Go to console.
Click the tile for the Firebase project you use for the website you're testing.
Click the settings gear and select Project settings.
Navigate to the Service accounts tab.
-
Click Manage service account permissions.
-
To create a new Firebase service account, click Create Service Account.
-
Under Service account details:
Enter a name, account ID, and description.
Then, click Create and Continue.
-
Under Grant this service account access to project:
Select a role: Firebase Cloud Messaging API Admin, or a custom role with permission
cloudmessaging.messages.create
.Click Continue.
-
Under Grant users access to this service account:
Leave both fields blank.
Click Done.
You'll land back on the Service Accounts page.
# Step 2.4: Create and download a JSON private key for the new FCM API
TIP
As you complete this step, do not delete your website's legacy server key from Firebase. Keep it in place, to help ensure the success of any in-progress push notification sends associated with that key, and it also allows you to revert to the legacy FCM API if necessary.
Now, create and download a JSON private key associated with the Firebase service account you just created:
Make sure you're still in the Firebase console, in the correct project.
-
On the Service Accounts page, in the row for your new Firebase service account (created in the previous step), click the three dots in the Actions column. Then, choose Manage keys.
-
Select Add Key > Create new key, and choose JSON.
Click Create. This creates the JSON key and downloads it to your machine.
# Step 2.5: Configure your sandbox project to use your new FCM private keys
To configure your sandbox project to use the new JSON private keys for FCM:
Sign in to your sandbox Iterable project with a user who has the Setup and Manage Channels permission.
Navigate to Settings > Web Push.
-
In the HTTP V1 row of the Integrations table, click Configure.
-
In the Configure Firebase integration window, upload your JSON private key, and enter the Sender ID you found above.
Click Save.
# Step 2.6: Send a test message from your sandbox project
After you upload and save your JSON private keys for FCM, a Test Firebase integration window appears. From this window, send a test web push notification to verify that the new private keys work as expected.
In this window:
- Paste the browser token you found in step 2.2, above. Remember, this should be a browser token for an internal user, not an end user or customer.
- Enter a message title and message body.
- If you like, enter the URL of an icon to associate with the web push notification and a URL to open when the user clicks the notification.
- Click Send test. The test user should see the web push notification.
# Troubleshooting the test message from your sandbox project
If the test message doesn't arrive as expected, try the following:
- Make sure that the user to whom you're sending the test message has agreed to receive web push notifications from the website in question.
- Make sure you're using the correct browser token.
- Make sure the FCM private key file (JSON) you uploaded to Iterable is connected to a Firebase service account associated with the website you're testing.
- Make sure the Firebase service account associated with the FCM private key has
permission
cloudmessaging.messages.create
. - From the associated web push integration in a production Iterable project, try send a test web push notification to the same browser token you just tested from the sandbox project. If the test notification doesn't arrive on the user's device, your app may not be configured correctly to display push notifications.
If the test user still doesn't receive your test web push notification, contact Iterable support.
After you've tested your app in a sandbox environment, you can test update your
# Step 3: Update your production Iterable projects
IMPORTANT
Complete this step for each of the production Iterable projects that you use to send web push notifications. However, for any given Iterable project, don't make these updates until you've sent a successful test web push from your sandbox project.
After sending a successful test web push notification to a given website, update any production Iterable projects that are associated with that website.
For every relevant production Iterable project:
Sign in to the Iterable project, with a user who has permission to Setup and Manage Channels.
Navigate to Settings > Web Push.
-
In the Legacy Server Key row of the Integrations table, click Update.
-
In the Configure Firebase integration window:
Upload the JSON private keys you created for this website in step 2.4, above.
Enter the Sender ID you found in step 2.1, above.
Copy down the server key and sender ID shown in the window, in case you need to revert. These should match the values you found in step 2.1, above.
Click Save.
-
In the Test Firebase integration window:
Enter the same browser token you found in step 2.2, above.
Enter a message title and message body.
If you like, enter the URL of an icon to associate with the web push notification and a URL to open when the user clicks the notification.
Click Send test. The test user should receive the message.
NOTE
You can choose send a test push notification later. However, if possible, do it right away.
When you upload a new FCM private key (JSON) to a given Iterable project, Iterable immediately starts using that key to send web push notifications for that project — even if you don't send a test message right away.
If there's a problem with the new FCM private key, or with your project's web push integration, Iterable won't be able to send web push notifications until you've resolved the issue. So, if there's a problem, it's a good idea to find out right away.
# Troubleshooting a production project
If the test web push notification from your production project doesn't arrive as expected, you can re-upload your private key or revert to the legacy FCM API while you troubleshoot.
# Re-upload your private key
If you accidentally uploaded the wrong private key (JSON file), follow these steps to try again:
- In Iterable, in the row associated with the web push integration you're updating, click the overflow menu (three dots). From this menu, select Edit integration.
- In the Configure Firebase integration window, upload the correct private key (JSON file), enter the correct Sender ID, and click Save.
- In the Test Firebase integration window, send a test push notification.
If the test message still doesn't appear on the test user's device, try reverting to your legacy API key while you troubleshoot the problem (see next section).
# Revert to your legacy FCM server key while you troubleshoot
WARNING
Your legacy FCM server API key will only work until Google starts turning off the legacy API, on July 22, 2024. If, by that point, you haven't updated the web push integrations in your Iterable projects, you won't be able to continue sending web push notifications. If you're having trouble, contact Iterable support.
To revert an Iterable project back to your legacy FCM server API key:
Sign in to your Iterable project.
Navigate to Settings > Web Push.
In the Integrations section, click the overflow button (three dots) and select Revert to legacy API key.
-
In the Configure Firebase integration window:
Enter your the FCM server key for the website in question.
Enter the FCM sender ID for the website in question.
Click Save.
In the Test Firebase integration window, send a test push notification.
# Troubleshooting ideas
To investigate why your production push integration isn't sending push notifications as expected:
- Make sure the FCM private key file (JSON) you uploaded to Iterable is connected to a Firebase service account associated with the website you're testing.
- Make sure the Firebase service account associated with the FCM private key has
permission
cloudmessaging.messages.create
.
TIP
If you've checked these things and your test user still does not receive a push notification, contact Iterable support.