Push Notifications

Marketing Cloud Personalization supports Push Notification campaigns for Android apps using Firebase Cloud Messaging (FCM).

If you'd like to use Personalization to send push notifications to your app via FCM, you'll need to provide an FCM private key JSON file. To obtain your FCM private key JSON file and then add it to Personalization, do the following.

  1. Open your Firebase Cloud Messaging console for your app.

  2. Navigate to Project Overview > Project settings > Cloud Messaging.

  3. Click Manage Service Accounts.

  4. Click + CREATE SERVICE ACCOUNT.

    The default service account is assigned the Firebase Admin SDK Administrator Service Agent role that provides more access than necessary. To limit access and enhance security, we recommend creating a service account with only the Firebase Cloud Messaging API Admin role.

  5. Provide appropriate values for Service account name, Service account ID, and Service account description.

  6. Click CREATE AND CONTINUE.

  7. Under Select a role, search for and select the Firebase Cloud Messaging API Admin role. This role includes the cloudmessaging.messages.create permission, which is the only "write" permission required.

  8. Click CONTINUE.

  9. Optionally, grant users access to this service account.

  10. Click DONE.

  11. Under the Actions column for the newly-created service account, click Manage keys.

  12. Click ADD KEY > Create new key.

  13. Select JSON as the Key type and click CREATE. The private key JSON file is now saved to our computer. Ensure that you've stored the files appropriately and click CLOSE.

  14. Log in to the Personalization UI and select the Dataset.

  15. From the left-hand menu, click Mobile > your app > Mobile Push Setup.

  16. Under Firebase Cloud Messaging (FCM), upload your private key JSON file.

  17. Click Save.

To set up your app to use Firebase Cloud Messaging, do the following.

Additional Details

  • You can only send push notifications to the most recent user. For more information, see setUserId.
  • Personalization automatically tracks clicks and opens from Firebase notifications under typical circumstances. However, when the app receives push notifications while foregrounded, if you decide to display custom content or launch an Activity with a launchMode other than standard, you can ensure accurate campaign click tracking by following the instructions in the method documentation for trackClickthrough(Intent) and trackClickthrough(Map).
  • For information on testing your campaigns, see the Testing guide.
  • To set up mobile data campaigns for your app, see Mobile Data Campaigns.