Welcome to my blog. In today’s blog I will discuss a simple requirement on how to send notifications across apps in canvas app.
Did you ever had the following requirements?
- Send notification to a user from an app.
- Open a canvas app when a user press on the push notification.
- Pass data across canvas apps using push notifications.
This is a functionality which is there for sometime. But one of those hidden gems which are not frequently used.
Without wasting any more time, let’s get the ball rolling.
I have two apps in my environment.
I want to send a push notification to a user. When the user open the push notification in mobile, it shall open up the Inspector app with certain parameters.
My target application here is the Inspector app. The first thing I will do here is to get the ID of the Inspector App. In your maker portal, go to app details and get the ID of the app.
Now I open the “Demo APP” in edit mode. The first thing to do here is to add the datasource “Power Apps Notification“.
You need to enter the Id or the Url of the app. Paste the ID of the target app from the previous step.
I created a button to send the push notification. Below is the command on select of the button
PowerAppsNotification.SendPushNotification(
{
recipients: ["admin@M365x60443864.onmicrosoft.com"],
message: "There are new items in app. Open to check them out!",
params: Table(
{
key: "param1",
value: "The value for param1"
}
),
openApp: true
}
);
Observe the “params” parameter in the function. It’s optional but you can use it to pass additional parameters to the target app when you open it.
The parameter “openApp” shall open the app when the push notification is clicked.
All set and done, it’s time to test. When I click the button the notification is sent. And below is a screenshot of the notification on my mobile. Note that it clearly mention the target app name – “Inspector“
When I click on the notification, the Inspector app opens with the parameters provided in the notification.
Hope this helps. You will also like the below posts.
Debajit Dutta
Business Solutions MVP
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.