·
4 min read

Add push notifications to your app and boost user engagement

Push notifications are ubiquitous today to increase usage and retention of mobile apps and beyond. PowerApps community, we heard your feedback and are proud to announce today PowerApps support in-app push notifications!
With our new Powerapps Notification connector you can to send various notifications that directly target your apps. You can trigger the notification from either another app or a flow depending on your trigger scenario.

How does it work?

First, choose the app that is targeted for the push notification. This is the app that is going to open when the user taps on the notification.
Second, you need to choose either an app (can be the same one as above) or a flow that is going to trigger the notification depending on the scenario to enable. Diagram below should help describe this in detail:

Pic1-InappPushNotification
In a nutshell, the PowerAppsNotification connection is configured to target a specific app.  The connection can be used in various apps (including the target app) and flows to trigger a push notification. This gets propagated to all your app users regardless of the platform they use on their device: iOS, Android or Windows. As soon as they tap on the notification the targeted app opens for them. Let’s further showcase how this would work when triggered from an app.

 

Example

Let’s imagine we have a Case management app that allows to move cases between states and also re-assign them. I’ll go ahead and enhance this app to send a push notification to the new owner each time a case is re-assigned.
I’ve created the “Case Management” app from the PowerApps template. Please take a look at “Create an app from template tutorial” for detailed steps on how to quickly create an app from template.

As pre-requisites, you’ll need an environment where common data model is enabled. To learn more about it, please take a look on this great introductory article.

Pic1-CreateApp

The application is managing cases end to end allowing users to create, update the state and further change the owner. The goal of our example comes down to triggering the push notification when the user taps on the change button highlighted below.

Pic5-AddPushNotif

 

Adding a push notification to the app – step by step

 

Step 1 : Get the application id to target with push notifications.

 

Go to our maker portal, web.powerapps.com . Here, let’s grab the ID of the app receiving push notifications as shown below:

Pic3-GetAppId

Step 2: Create the connection

Go to Connections tab and follow steps below. Paste in the app ID.

Pic4-CreateConnection

Tip: You can rename your connection in the Connections tab, details. This would make it much easier to distinguish between other connections of the same type.

 

Step 3: Add the connection to the trigger app.

In this example, I’ll use the very same app as trigger. The user that re-assigns the case is the one to trigger the push notification. The new case owner is the one to receive the push notification. Here is a quick capture on adding the connection:

Pic6-AddConnectionToTheApp

Step 4: Call the SendPushNotificaiton method from PushNotification connection

First, let’s decide where we want to make the call. The change button calls SubmitForm and our goal is to only send a push notification if the owner was successfully updated. In order to do that, we need to have this call happen OnSuccess trigger in the form control, so let’s select this control and further select “OnSuccess” property.

We’ll further make a basic call into PushNotification connection where specify the user to send notification to and further we want to specify the message to show on the push notification:

PowerAppsNotification.SendPushNotification({recipients:[<list of email addresses>], message:”A new case was assigned to you.”})

The email address is a lookup on the Contacts entity using the contactId provided in the dropdown. The formula becomes:

PowerAppsNotification.SendPushNotification({recipients:[First(Search(Contact,ContactsDropDown.Selected.ContactId,”ContactId”)).EmailPrimary], message:”A new case was assigned to you.”})

Pic7-CallSendPushNotification

Step5: Test it out

To test the notification, go to your Contacts table in CDS and modify a contact to have your email address.  Next, refresh your data source, navigate to the change contact screen, re-assign the case and… click “change” button. A push notification is sent to all devices where you have PowerApps installed, hooray!

Here is a sneak peak of how the push notification looks like: it has the custom message that was specified and as title it shows the target application name.

Pic8-PushNotificationIsSent

 

Frequently asked questions

Question 1: I’ve created and app and shared with everyone in my company. Does this mean I can now send push notifications to everyone?
Answer: In order to receive the notification the user needs the app showing under “My apps” in their player. They need to either open the app from “All apps” view or pull it from the AppSource org gallery in home.dynamics.com.

Question 2: Can I get any app id and just target it with push notifications?
Answer: You need to have maker permission on the app you want in order to create such connection.

Known limitations

For Windows Phone client the notifications don’t show currently.

We do not provide push notifications yet for users who only run apps in the web browser.

The notifications shows the PowerApps generic icon instead of showing the specific icon of the app.

Want to take this to the next level?

You can configure dynamically the message, the set of targeted users and further pass in additional parameters to pass to the target app. Also use a Common Data Service trigger in flow to trigger sophisticated push notifications.

These parameters need to be key-value pairs that can be parsed by the app via Param() function. When the user opens the app via a push notification, the parameters enable you to customize the elements shown or navigate to another page.

 

Please engage with us on this very blog post and  our forum and let us know how this works for your apps and what improvements you need, looking forward to your feedback!