Firebase Cloud Messaging

πŸ‘

Estimated setup time

1 hour

Requirements

  • Your Firebase project ID
  • Service account JSON credentials

Aampe will essentially call the Firebase Cloud Messaging API on your behalf.

Setting up Firebase Cloud Messages involves four steps:

  1. Enable the Cloud Messaging API
  2. Create a custom role for message creation
  3. Create a service account
  4. Generate a key

πŸ“˜

All the next steps assume that you start from your Google Cloud Platform console with your Firebase project selected.

Enable the Cloud Messaging API

  1. Type "Firebase Cloud Messaging API" in the Search products and resources textbox.

  2. Choose Firebase Cloud Messaging API from the list.
1345
3. Click on the blue Enable button. 1347

Create a custom role for message creation

A custom Role must be created in the system to allow Aampe to trigger notifications using
the API because the default roles do not provide granular enough permissions.

  1. Type "Roles" in the Search products and resources textbox and select the Roles (IAM and Admin)
    option. This will take you to the Roles page.
1450
  1. Click on + CREATE ROLE

  2. Fill in the role Title, Description and ID according to your conventions.
1450
  1. Click on +ADD PERMISSIONS

  2. In the window that opens, search for cloudmessaging.messages.create using the textbox to
    the right of the Filter and select the cloudmessaging.messages.create entry that appears.
1452
6. Tick the `cloudmessaging.messages.create` permission and click on **ADD** 845
7. Once added, click on **CREATE** to complete the role creation. 1452

Create a service account

  1. Type "Service accounts" in the Search products and resources textbox.

  2. Choose Service accounts (IAM and admin) from the list. This will take you to the service
    account page.
1452
3. Click on **+ CREATE SERVICE ACCOUNT** 1450
4. Fill in the Service account name, ID and description according to your conventions. 1452
5. Click on **CREATE AND CONTINUE**
6. On the Grant this service account access to the project screen, click on the **Select a role** dropdown.
7. Under **Quick access > Custom**, select the custom role you created in the previous step. 1455
8. Click on **+ ADD ANOTHER ROLE** and then on the **Select a role** dropdown.
9. Type "Firebase Cloud Messaging Admin" in the box near the Filter.
10. Select the suggested **Firebase Cloud Messaging Admin** role.
1452
11. Click on **DONE** to complete the service account creation. 1450

πŸ“˜

This step assumes that you created a service account and assigned the "Firebase Cloud Messaging
Admin" and custom message creation roles to it.

Generate a key

  1. In your "Service accounts" page, find the service account you created for Aampe and click on the
    three dots in the Actions column and select Manage keys
1450
  1. Click on ADD KEY and select Create new key
1450
  1. Select the JSON Key type and click on CREATE
817
  1. Your browser will download a .json file with the key needed by Aampe.

πŸ“˜

You are done! All you need to do now is securely share your Project ID and JSON file with Aampe.