Set up push notifications
Create a Firebase service account key and send it to Subrite, create M2M tokens for the app (Push Subscription) and the server (Push Content), and decide whether to discard topics.
Create a Firebase service account key and send it to Subrite, create M2M tokens for the app (Push Subscription) and the server (Push Content), and decide whether to discard topics.
Subrite uses Firebase Cloud Messaging to send push notifications, and needs credentials from your Firebase project to enable this.
If there isn't already a Firebase project for your app, set one up. Follow the guides in the Firebase docs.
Go to the Project settings of your Firebase project. Under Cloud Messaging, click the Manage Service Account link.

Click Manage keys under Actions.

Add a new key by clicking ADD KEY > Create new key.

Select the default JSON key type.

You should now have a JSON file from Google with the credentials needed to send push notifications.
POST the JSON contents of the credentials to the Subrite API.
POST{baseUrl}/api/v1/app-push/setup{
"providerCredentials": "{\"type\":\"service_account\",\"project_id\":\"test\",\"private_key_id\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\n<<private key here>>\\n-----END PRIVATE KEY-----\\n\",\"client_email\":\"firebase-adminsdk-zynzs@test.iam.gserviceaccount.com\",\"client_id\":\"100000000000000000000\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://oauth2.googleapis.com/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/firebase-adminsdk-zynzs%40test.iam.gserviceaccount.com\",\"universe_domain\":\"googleapis.com\"}"
}For the app to authenticate itself to the Subrite API when adding or removing subscribers, you need an M2M authentication token.
Go to the admin dashboard in Subrite, typically a URL like https://minside.YOUR_TENANT.no/admin/dashboard.
Click into Account settings, Settings, M2M Client. Click New Settings.

Fill in the form as shown below. Make sure the section Push Subscription has Read and Update selected. Click Save.

Copy the provided JWT string and keep it for embedding in the app.
You need one more M2M token, this one for triggering the dispatch of new push notifications to all subscribers.
Repeat step 4, but this time select the section Push Content with Read and Update selected. Click Save.

The two selections map to the scopes the server integration needs:
push-content:update: dispatching a new push notificationpush-content:read: reading campaigns back and looking up their delivery statsCopy the provided JWT string and keep it for embedding in your server environment.
By default, a push notification is only filtered by topic when you send topics with it. If you send none, every subscribed device is notified. If you do send topics, only devices that subscribed to at least one of them are notified, and if no device matches, no one is notified at all. The API call still returns success, and the campaign ends up with status: "skipped" when you read it back (see ).
That is a common trap when your CMS puts article tags or categories into the topics it sends with the notification, while your app subscribes devices without any topics.
If that is your case, go to the admin dashboard and click into Account settings, Settings, Communications. Open the Push notifications tab and turn on Discard topics.
The setting is off by default. When it is on, the topics on the notification are ignored, and every subscribed device on your tenant is notified. This applies to all sends, both the ones triggered from your server and campaigns composed in the admin dashboard. The topics are still stored on the campaign, so you can see what was sent.
Leave it off if you rely on per-topic opt-in.
The Push notifications tab is only available for tenants with push notifications enabled.
The basic setup is now ready, and you can continue with .