In this post, we will learn how to build a PVA Bot which will give users link to various Power App created in an environment.
Here, we will assume that we have a new production environment where various makers from the organization will be building and sharing Apps. However, the organization needs a single and structured method for users to find link to any Power app and in the next stage ability to capture all user feedback, bugs, or enhancement requests and assign them to the owner of the Power Apps.
This post is structured as below: 1 - Store details of every new App created in the environment 2 - Create a Bot that provides link to any App as required
3 - Further enhancements
Step 1: Create a cloud Flow which will store details of App in the environment
We will follow the following steps to create a Flow which will run daily and store details of App which were created in the environment over last one day period.
1.1 - Create a scheduled Flow with daily run frequency
1.2 - Retrieve the environment name using workflow()?['tags']?['environmentName']
1.3 - Add action to Get Apps as Admin, use output from step 1.2 for the Environment parameter. This will return all Apps in the environment.
1.4 - Use Filter action to get Apps which were created in the last one day, using addDays(utcNow(),-1)
1.5 - Loop through the resultant array from step 1.4 using Apply to Each, and Add a new row to Dataverse table with details of the App.
Step 2: Create a Bot where user can get link to App by providing name of the App
2.1 - Go web.powerva.microsoft.com and create a new Power Virtual Agent
2.2 - Under topics, add a new topic - "Link to App"
2.3 - Add 5-10 trigger phrases that your users might use to get link for a Power App
2.4 - Save the topic and go to authoring canvas
2.5 - Add a step to ask the user name of the app (or a search keyword) for which they need the link. We will use entire response from the user to search our database created in stage-1 to get the link to the Power App (if available)
2.6 - Add a call an action and select Create a flow.
2.7 - In the Flow, we will use contains ODATA filter query to get row from our Dataverse table created in Step-1. See details of Flow below:
The filter query used is:
This Flow can be made more robust by checking the number of rows returned. If rows returned are 0, we can respond back to the bot and inform user that no matching App was found. Further, we are only returning a single text value from Flow to the Bot, however multiple information can be returned such as app name, app owner details as required by the business use case.
2.8 - After saving the Flow, we come back to the authoring canvas on the Power Virtual Agent. Add an action for the recent Flow that we have created and complete the required input parameters.
2.9 - Final step is to respond back to the user with the Link to the App and then End the conversation.
See below for the PVA bot in action:
3 - Further enhancements:
3.1 - This bot can be enhanced by adding another topic for users to submit any bugs, feedback or enhancement requests for an App. The user journey will be:
3.2 - User will say they want to say something about the App
3.3 - Bot will ask name (or a search keyword) of App and based on user input, call a custom Flow and return full name of App
3.4 - Bot will ask details of feedback
3.5 - Bot will call a Flow and store user response and App data stored in a Dataverse table. The same Flow will notify App owner about the feedback.