How to send push notifications from Power Apps
With Power Apps, you can make a mobile application very quickly. But did you know that you can also send push notifications to the Power Apps user(s)? They are similar to the notifications you get on your phone for new WhatspApp messages or any app you use on your phone.
In this article I will show you how to use Power Automate cloud flows to deliver push notifications when specific events take place in Power Apps. The first scenario is for a canvas app, then we’ll also look at the model-driven app experience.
Example – Your beer review has been liked
We have a mobile application implemented as Canvas Power Apps that reviews non-alcoholic beers, called “Funtapped”. App users can like and comment on each other’s reviews:
We would like to send the user a notification when someone likes their review.
Sending a push notification with Power Automate
First, we create a flow that starts when the user adds a like. That is, every time a new row appears in the Beer rating likes table:
We want to show the liker’s name in the notification. Let’s get all the information about the like (Get row by ID (Likes)) and expand the query to cover the name and email address of the creator of the row.
The creator of the line is in practice the user who liked the review:
We also want to show the name of the beer that the liked review is related to. This information can be found in the rating row related to the liking event (Beer rating). At the same time, we get the email address of the user who posted the review, which we need for sending the notification.
Now we finally get to sending the actual push notification:
The new flow editor can’t display all parameters properly yet, so let’s switch to the classic one for a while.
The parameters of the Send push notification V2 function are:
- Mobile app: Power Apps
- Your app: The application which the notification relates to
- Recipients: To whom the notification is sent (email address)
- Message: The content of the announcement
- Open app: Whether to open the app related to the notification by clicking on the notification.
- Parameters: Parameters that may be passed to the application
And then we give it a try! The review is liked and a notification appears on the phone screen. Clicking on the notification opens the Funtapped Power App.
Power Apps notifications are a nice addition, but you shouldn’t base any critical communication on them. If the user has not enabled preview in Power Apps notifications, the notification will look like this:
Now the user can’t even see which Power Apps the notification relates to. Of course, the correct application will open if they click on the notification.
Parameters
The notification can also contain parameters. Below the notification contains the ID of the liked rating (beerratingid):
This seems handy. When the user clicks on the notification, we can read the parameter passed by the notification in the application in the normal way with the Param command:
Param("beerratingid")
With this data, we can open the review to which the announcement is related.
However, the joy is short-lived. The parameters can only be read if the application is started by clicking on the notification. If the application is already running in the background (as at least all applications are for me), the parameters are not read when the application is activated.
Model-driven Power Apps
Power Automate can also send model-driven application-related notifications to the user’s mobile device.
In this case, the table (entity) and its form or view are selected, which opens when the notification is clicked. You can also pass the record to be opened (Record ID) to the form:
In practice, the user receives a notification on their mobile device, which, when clicked, opens the model-driven application in the Power Apps mobile player.
The function should not be confused with the in-app notifications (picture below), which I wrote about in my previous article.
Summary
Power Apps push notifications are a great way to send different notifications to users’ mobile devices. Just remember that they won’t necessarily get delivered there. The user may have disallowed the app’s notifications on their phone. The power saving features of the mobile device may also prevent notifications from working.
Push notifications can also be sent directly from the Canvas Power Apps application. In theory. The related function is so lightly documented that I couldn’t find a working way to pass the required parameters to it. So, your best bet is combining Power Automate cloud flows with your apps to handle the business logic and sending of the notifications.
In my environment the Param() function never get back the value of the passed parameter of the “Send push notification V2” call.
I’m sure, that my App is newly started by the application.
Any idea what is going wrong?
Regards,
Norbert
Passing parameters with push notifications is a little bit tricky. I would try:
1) testing that the reading parameter works with the browser (add it as a url-parameter). Just to make sure that there is no bug on reading and handling the parameter
2) Force kill Power Apps from the background (on the phone) and then send a new push notification and check what happens