You will learn
Learn how to set up your Google service account and enable Firebase Cloud Messaging so you can send Klaviyo push notifications to Android devices.
Before you beginBefore you begin
Before following the steps below, you must have an existing Firebase project.
Enable Cloud messaging APIEnable Cloud messaging API
- Navigate to the Google Cloud console.
- Select your Firebase project from the dropdown in the top left corner.
- Search for “Firebase Cloud Messaging API.”
- Select Firebase Cloud Messaging API from the marketplace list.
- In the modal that appears, click Enable.
Create a custom role that supports message creation
- From the Google Cloud console dashboard, select IAM & Admin under the Quick Access section.
- In the left menu, navigate to the Roles section.
- Click +Create Role.
- Fill out details about the role (name, description, etc.).
- Click +Add Permissions.
- Add only the cloudmessaging.messages.create permission. (For more details, see Google’s instructions for creating a custom role.)
- Click Add.
- When ready, create the role by selecting Create.
Create a Google service account
- In the left side menu of the IAM & Admin section, navigate to the Service Accounts tab.
- Click +Create Service Account.
- Fill out the Service account name and Service account description (optional) fields.
- Click Create And Continue.
- Click into the Select a role field.
- Select the custom role that you just created. Here, we choose “Test Role,” but select the role you created in the previous section.
- Click Done to finish creating the service account.
Generate a service account key
- In the Service Accounts page, click on the email address for the service account that you created in the previous section.
- Navigate to the Keys tab.
- Click Add Key.
- Click Create new key.
- Under Key type, select JSON.
- Click Create to download the service account key file.
Note: you cannot download the file again, so ensure that you can locate the file on your computer. The downloaded JSON file should have the following format:
{ "type": "service_account",
"project_id": "PROJECT_ID",
"private_key_id": "KEY_ID",
"private_key": "-----BEGIN PRIVATE KEY-----\nPRIVATE_KEY\n-----END PRIVATE KEY-----\n",
"client_email": "SERVICE_ACCOUNT_EMAIL",
"client_id": "CLIENT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/SERVICE_ACCOUNT_EMAIL" }
Outcome
Now that you created and assigned the role to your Google service account, you can begin setting up Klaviyo Android push notifications.
Additional resources