Push Notification Sender
The service requires the following environment variables:
CONFIG_FILE_PATH: the path where the configuration file is mounted
The service requires a configuration file in JSON format with the following fields:
sendersInitOptions: object, specifies the configuration for Android and iOS senders. It has the following fields:
android: object, specifies the configuration for Android sender. It has the following fields:
key: string, the Firebase key for sending Android notifications
ios: object, specifies the configuration for iOS sender. This object is passed directly to the APN Provider. So you can specify the options listed here.
collectionsOptions: object, specifies the configuration of the CRUD collection used by the service. It has the following fields:
notificationsCollectionsPath: path to the
devicesCollectionPath: path to the
usersCollectionPath: path to the
bufferSize: maximum number of notifications to be sent a once
An example of configuration file is the following:
In the case above, you must mount the
key.pem files of the iOS certificates at the paths indicated in the configuration file.
The service is based on two
users collection is needed for
/groups route to work.
Here you can see how to create a CRUD collection from Mia-Platform Console.
This collection contains the registered devices, a document containing the registration token (so there may be multiple documents for each user). This collection should not be used directly by clients, who have authenticated registration APIs! The properties are as follows:
userId: string or ObjectId, reference to the user who has registered
token: string, the token ios or android that identifies the device and the app
tags: list of strings, marks of users interested in topics or grouped as a group of users
platform: string, the platform of the device
This collection keeps the history of notifications sent. Property:
title: string, the title independent from the platform
body: string, the message independent of the platform
payload: the custom payload independent from the platform
platformSpecificContent: object, notification customizations depending on the platform
destination: object, a descriptor that contains the type
typeof the destination and the list of recipients
outcome: object, the result of sending the notification
This collection will be only used by
/groups route. It contains users' data.
This collection must have property
groups, an array of strings: it represents the groups a user belongs to.
This service will send notifications to groups by collecting the ids of users belonging to groups specified as input.