The "Power Apps Notification" connector enables app builders to send push notifications to mobile devices. The notifications are targeted at specific users based on email addresses. When a user clicks a message, we can configure a target app to start and we can optionally pass input parameter values to the target app.
Compared to the first version of the connector, the current version (V2) offers support for the Field Service (Dynamics 365) and Dynamics 365 Sales mobile apps. However, the syntax to send notifications is slightly different. This post describes the formula to send notifications from a canvas app and for further reading, the official documentation for the connector is here.
What arguments does the SendPushNotificationV2 method expect?To begin, let's examine the arguments that the "Send Push Notification V2" method expects. A simple visual way to explore this is to call the method from Flow. As the screenshot below illustrates, there are at least five arguments:
- Mobile app - this specifies the app player that hosts the app (ie - Power Apps, Field Service, Sales)
- Your app - this specifies the app that receives the push notification
- Recipients - this specifies the email address of 1 or more recipients of the notification
- Message - this specifies the notification message
- Open app - this specifies whether to open "your app" when the user taps the notification message
Retrieving the App ID of the target app
The push notification messages are associated with a specific app. From Flow, a drop-down displays all available apps and we use this to select an app.
To send a message from Power Apps, however, we need to specify the target app by "App ID". We can determine this through the details of the target app in the Maker Portal, as shown below.
How to call SendPushNotificationV2 from Power Apps
To send a push notification from a canvas app, we first add a connection to the "PowerAppsNotificationV2" connector through the Data panel of the designer.
We can then use the following formula to send a notification:
"Here is a notification message",
The pertinent parts of this syntax are as follows:
- The first argument is a string that specifies the app type. This will be "PowerApps", but can also be "FieldService", or "Sales".
- The second argument specifies the target app. We pass
a string representation of a record that identifies the app. The appIdentifier field specifies the App ID that we retrieved above. We must also include a field called type that specifies "CanvasApp", and a displayName field which can be left blank. Because we pass string values within a string, note how we escape the appIdentifier and type values with double-double quotes.
- The third argument specifies a table of email recipients.
- The fourth argument specifies the push notification message.
How to configure the notification to open the app with specified parameter values
To adapt the formula so that displays a notification
message that opens the target app with a specified parameter value, we
can use the syntax beneath.
"Here is a notification message",
This example passes the value 88 through a parameter called RecordID. From Power Apps, we can retrieve this value by calling the param
This highlights the typical way to implement deep linking functionality in an app - that is, to open an app and navigate the user directly to a specified record.
How the notification appears
The screenshot below shows the appearance of the notification on a mobile device
We can send push notifications to mobile devices that target specific users based on email addresses. This post demonstrated how to carry out this task by calling the "SendPushNotificationV2" method of the PowerAppsNotificationV2 connector.