Google Firebase Messaging
With the actions provided by the integration, you will be able to send all types of notifications (to a single registered device, to a list of registered devices, to a topic) with broad support for all major device platforms (Android, iOS - APNS and Web Push for browsers). Sending to a list of devices is somewhat deprecated by Google and as a replacement, sending to a topic is recommended. It is also limited to 100 devices per send request. Topic messaging on the other hand supports unlimited number of registered devices, with a device being subscribed to no more than 2000 topics.
The main action provided is the Firebase - Send push notification which makes the actual request to the Google Firebase APIs. Because each device platform has it’s own particular notification configurations, we provide 3 additional actions to help you build specialized notifications for each device: Firebase - Create Android message, Firebase - Create iOS message or Firebase - Create WebPush message. The specialized configurations generated are then passed as parameters to the main action.
For testing purposes you can find a sample implementation for registering and receiving notifications through the browser. Note that it is not production quality and should not be used as is.
Before starting to use the Send push notification action, make sure that the Firebase Cloud Messaging API is enabled for your Firebase project.
Here are the parameters for the Send push notification action:
- Credential Key - To send messages through the Firebase Messaging API the request needs to be authenticated. A private key file must be generated through the Firebase Console (docs). This file must be stored on the server serving the DNN site and an entry must be added in the DNN site web.config pointing to it. The entry must be added in the appSettings section like below. The key can have any value, but the value must be the full path to the credential file - e.g. C:\www\file.json.
<appSettings> <add key="fcm_credential" value="<path to file>\<filename>.json" /> </appSettings>
The key will be passed as value to this action parameter.
Message Audience - As stated above a notification can be sent to a single registered device, a list of registered devices or a topic. With this parameter you select that behavior.
Based on the value selected you will have one of the following three parameters:
- Device Token - To specify the device to send the notification to.
- Device Tokens - To specify the comma separated device list to send the notification to.
- Topic Name - To specify the topic to send the notification to.
Message Title - This will define the default notification title. It can be overridden by the specific device notification configuration.
- Message Body - This will define the default notification body. This as well can be overridden by the specific device notification configuration.
- Android Specific Notification Json - Here you can pass the Android specific configuration, generated by the Firebase - Create Android message action.
- iOS Specific Notification Json - Here you can pass the iOS specific configuration, generated by the Firebase - Create iOS message action.
- WebPush Specific Notification Json - Here you can pass the WebPush specific configuration, generated by the Firebase - Create WebPush message action. This will take effect on devices supporting the WebPush protocol, usually web browsers.