Connect to Azure Notification Hubs
The server SDK sendMobileNotifications function allows you to send notifications to subscribed user devices via the Azure Notifications Hub push engine. To connect FintechOS Platform with the Azure Notifications Hub, follow the steps below:
- Configure your notifications hub on the Microsoft Azure cloud computing service. For details, see the Azure Notification Hubs documentation.NOTE
You have to create one notification hub per mobile app, per environment. - In Vault, add secrets for the hub name and endpoint settings of each client application, based on the model below:
| Key Path | Key Name |
|---|---|
| kv/<environment>/<application>/app-settings | azure-mobile-notifications-myApp1-hubname |
| kv/<environment>/<application>/app-settings | azure-mobile-notifications-myApp1-endpoint |
| kv/<environment>/<application>/app-settings | azure-mobile-notifications-myApp2-hubname |
| kv/<environment>/<application>/app-settings | azure-mobile-notifications-myApp2-endpoint |
| Key Name | Key Value |
|---|---|
| azure-mobile-notifications-myApp1-hubname | xxxhubname1 |
| azure-mobile-notifications-myApp1-endpoint | Endpoint=sb://xxxnamespace1.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature1;SharedAccessKey=xxxxxxxxx1 |
| azure-mobile-notifications-myApp2-hubname | xxxhubname2 |
| azure-mobile-notifications-myApp2-endpoint | Endpoint=sb://xxxnamespace2.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature2;SharedAccessKey=xxxxxxxxx2 |
In the example above:
- We set up two client applications that will receive notifications: myApp1 and myApp2.
- The notifications are sent using the xxxhubname1 and xxxhubname2 Azure notifications hubs respectively.
- The endpoints for the two hubs are sb://xxxnamespace1.servicebus.windows.net/ and sb://xxxnamespace2.servicebus.windows.net/.
- The shared access key names are DefaultFullSharedAccessSignature1 and DefaultFullSharedAccessSignature2.
- The shared access keys are xxxxxxxxx1 and xxxxxxxxx2.
<app-settings>
...
<add key="azure-mobile-notifications-myApp1-hubname" value="xxxhubname1">
<add key="azure-mobile-notifications-myApp1-endpoint" value="Endpoint=sb://xxxnamespace1.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature1;SharedAccessKey=xxxxxxxxx1">
...
<add key="azure-mobile-notifications-myApp2-hubname" value="xxxhubname2">
<add key="azure-mobile-notifications-myApp2-endpoint" value="Endpoint=sb://xxxnamespace2.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature2;SharedAccessKey=xxxxxxxxx2">
</app-settings>
Push Notifications Log
Sent notifications are saved in the FTOS_DPA_MessageQueue table. The table contains an entry for each notification sent to each user. This message queue can be viewed at the http://localhost:57123/Main#/entity/FTOS_DPA_MessageQueue/list link:
| Attribute | Description |
|---|---|
| ToAddress | Mobile app name. |
| UserId | ID of the user that received the notification. |
| Subject | Message queue subject set in the sendMobileNotifications function call that initiated the notification push. |
| Body | Message received by the recipient. |
| ChannelProvider | Provider with the same name as the Mobile App Name. |
| CommunicationChannel | Hardcoded to AzureNotificationHub. |
| ChannelProviderParams | Recipient filter used when sending the notification (example: "role: developer"). |
| MessageStatus | Hardcoded to Sent. If notifications were not successfully received, check the logging in the Azure Portal. |
FAQs
The messages remain in the Sent status. The main purpose of the message queue logging is to track notification attempts. For troubleshooting, the main place to check statuses is the Azure portal.
No. The Azure Notification Hubs support a maximum of 20 tags on a notification command, but FintechOS Platform automatically splits the notification into batches if this number is exceeded.
In the FintechOS Platform message queue, there are going to be 5 entries (one for each user). On the Azure notification hub, after sending the request from FintechOS Platform, the outcome will be: 3 Success, 0 Failed.
It is recommended to have 1 hub per app. In the Azure portal > Notification Hub setup, you can set only one key, which is normally associated to only one app.
There are exceptions such as Android-FCM where the API key corresponds to the Firebase project. In this case, you can:
- Add multiple apps on the same Firebase project, resulting in a single API key.
- Create a project for each App, resulting in separate API keys/hubs.