> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notifly.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Firebase

> Set up a Firebase project, configure FCM, and register an APNs authentication key for push notifications with Notifly.

Notifly uses [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) to deliver push notifications and in-app popups.

* You need a Firebase project to use Firebase Cloud Messaging.
* This guide explains how to create a Firebase project and connect it to Notifly.

## 1. Prerequisites

### 1-1. Set up a Firebase project

Create a Firebase project and register your app in that project.

* See [Create a Firebase project](https://firebase.google.com/docs/projects/learn-more?hl=en).
* See [Add an app to a Firebase project](https://firebase.google.com/docs/projects/learn-more?hl=en#setting_up_a_firebase_project_and_registering_apps).

### 1-2. Configure Firebase for your platform

> [tab] Flutter
>
> You can configure Firebase for Flutter in either of these ways.
>
> 1. **Install and initialize Firebase with the FlutterFire CLI. This is the recommended method.**\
>    See the [FlutterFire setup guide](https://firebase.google.com/docs/flutter/setup?hl=en#configure-firebase).
> 2. **Install and initialize Firebase manually for each platform, iOS and Android.**\
>    Follow the instructions in the **Android** and **iOS** tabs below.
>
> Whichever method you use, make sure that your project includes these files after setup.
>
> * **Android:** `google-services.json`
> * **iOS:** `GoogleService-Info.plist`

> [tab] React Native
>
> Configure Firebase separately for Android and iOS. Follow the instructions in the **Android** and **iOS** tabs.
>
> > Register both the Android app and the iOS app in the Firebase console.

> [tab] Android
>
> Add the `google-services.json` file for the app registered in your Firebase project to your Android project.
>
> * See [Add a Firebase configuration file on Android](https://firebase.google.com/docs/android/setup?hl=en#add-config-file).
>
> > Place `google-services.json` in the `app/` directory.

> [tab] iOS
>
> Add the `GoogleService-Info.plist` file for the app registered in your Firebase project to your iOS project.
>
> * See [Add a Firebase configuration file on iOS](https://firebase.google.com/docs/ios/setup?hl=en#add-config-file).
>
> > Add `GoogleService-Info.plist` to the root of your Xcode project and make sure that it is included in the build target.

***

### 1-3. Register an APNs authentication key

For iOS apps, including React Native and Flutter apps, upload an **APNs authentication key** to your Firebase project.

* See [Upload your APNs authentication key](https://firebase.google.com/docs/cloud-messaging/ios/get-started?hl=en#upload-apn-authentication-key).

You need an APNs authentication key to send push notifications to iOS devices.

## 2. Enable the Firebase Cloud Messaging API (V1)

Enable the Firebase Cloud Messaging API (V1) to deliver push notifications and in-app popups to devices through Notifly.

1. Sign in to the [Firebase console](https://console.firebase.google.com/).
2. In the left menu, open **Settings > General**.

![Open Firebase project settings](https://mintcdn.com/notifly/dcFO7QF5JScPffiH/images/i18n/en/developer-guide/fcm/fcm-v1-guide-go-to-settings.png?fit=max\&auto=format\&n=dcFO7QF5JScPffiH\&q=85\&s=cb8ef81c141e4fe0afe5625dffe0513d)

3. Open the **Cloud Messaging** tab.
4. Check whether **Firebase Cloud Messaging API (V1)** is enabled.
   * If the API is enabled, continue to section 3 to register the FCM service account with Notifly.
5. If the API is disabled, click the icon in the upper right of the API section to open its management page.

![Firebase Cloud Messaging API enabled with its menu highlighted](https://mintcdn.com/notifly/dcFO7QF5JScPffiH/images/i18n/en/developer-guide/fcm/fcm-v1-guide-enable-api.png?fit=max\&auto=format\&n=dcFO7QF5JScPffiH\&q=85\&s=2761616e9ed430bb59d8d2f6ba9e36cb)

6. Enable the Firebase Cloud Messaging API in the Google Cloud console.

![Enable the Firebase Cloud Messaging API](https://mintcdn.com/notifly/dcFO7QF5JScPffiH/images/i18n/en/developer-guide/fcm/fcm-v1-guide-click-enable.png?fit=max\&auto=format\&n=dcFO7QF5JScPffiH\&q=85\&s=e5b5a4ee3cb49f80987f31b6cfaf9446)

## 3. Register an FCM service account with Notifly

To connect Notifly to Firebase Cloud Messaging (FCM), you need a JSON key for a service account with permission to send messages.
Create a **dedicated service account for Notifly** so that you can manage its permissions and keys independently.

### Create an FCM service account key

1. Open the [Service Accounts page in the Google Cloud console](https://console.cloud.google.com/iam-admin/serviceaccounts). This is separate from the Firebase console. In the project selector at the top, select **the same Firebase project that your app uses**. If the displayed project names differ, compare the **Project ID** in Firebase project settings.
2. Under **IAM & Admin > Service Accounts**, click **Create service account**.

![Service Accounts menu and Create service account button](https://mintcdn.com/notifly/WGuMIjE1pRKnkV4B/ko/developer-guide/image/fcm_v1_guide_open_service_accounts.png?fit=max\&auto=format\&n=WGuMIjE1pRKnkV4B\&q=85\&s=8af936501e856399f51ccc3e0baee7ae)

3. Enter a service account name and ID, then click **Create and continue**. For example, use `Notifly` as the name and `notifly-fcm-sender` as the ID.
4. In the **Permissions** step, search for and select **Firebase Cloud Messaging API Admin** in the role selector.

![Select the Firebase Cloud Messaging API Admin role](https://mintcdn.com/notifly/WGuMIjE1pRKnkV4B/ko/developer-guide/image/fcm_v1_guide_select_fcm_role.png?fit=max\&auto=format\&n=WGuMIjE1pRKnkV4B\&q=85\&s=6d3ab2fd359767d5f61e938d3dd01871)

5. Click **Continue**. Leave the next step, **Principals with access**, empty and click **Done**.
6. In the service account list, open the menu (⋮) to the right of **the dedicated account you just created** and select **Manage keys**.

![Manage keys for the dedicated service account](https://mintcdn.com/notifly/WGuMIjE1pRKnkV4B/ko/developer-guide/image/fcm_v1_guide_manage_keys.png?fit=max\&auto=format\&n=WGuMIjE1pRKnkV4B\&q=85\&s=7877b9291ef8f51bdb98c6a0f249d485)

7. On the **Keys** tab, select **Add key > Create new key**.

![Create new key in the Add key menu](https://mintcdn.com/notifly/WGuMIjE1pRKnkV4B/ko/developer-guide/image/fcm_v1_guide_add_key.png?fit=max\&auto=format\&n=WGuMIjE1pRKnkV4B\&q=85\&s=e17d48e1f9d8afc2aec53b0a84929f6b)

8. Select **JSON** as the key type and click **Create**.

![Create a service account key in JSON format](https://mintcdn.com/notifly/WGuMIjE1pRKnkV4B/ko/developer-guide/image/fcm_v1_guide_create_service_account_key.png?fit=max\&auto=format\&n=WGuMIjE1pRKnkV4B\&q=85\&s=3b2a67f1a8f62eb837c58a1f8bf76d77)

9. Store the downloaded JSON key file securely. It contains a private key. Do not put it in a public repository or include it in your app code.

### Add the key to the Notifly console

1. In the Notifly console, confirm the project and **development or production environment** that you want to connect. Then open **Settings > Channel Settings** and look for **Push Notification (App)**.
2. Click **Register** to add an account. To update an existing account, click the pencil icon next to its field. Paste the downloaded JSON into the appropriate field and save.
   * For a shared account, use **FCM Service Account**.
   * For separate accounts, use **Android FCM Service Account** and **iOS FCM Service Account**. To show both fields during registration, turn on **Register Platform-Specific Service Accounts**.

![FCM service account settings in the Notifly console](https://mintcdn.com/notifly/dcFO7QF5JScPffiH/images/i18n/en/developer-guide/fcm/fcm-v1-guide-notifly-setting.png?fit=max\&auto=format\&n=dcFO7QF5JScPffiH\&q=85\&s=a3271758dcefda93efb3d73b5e035297)

3. Send a push notification to a test device on the platform you integrated and confirm receipt on the device. Saving the key does not verify sending permissions or device delivery.

> [!NOTE]
>
> When you replace an existing key, verify the new key in the development environment before applying it to production.
> Store the existing configuration in a secure location so you can restore it if needed. Before removing the old account or key,
> confirm that no other service uses it and that the migration is complete.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.