cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gmurnock
Advocate I
Advocate I

Passing variables from PVA in Teams to Power Automate

Do we have the ability to pass variables from a PVA in Teams to "Call and action" Power Automate?  Or is this version in Teams a very basic BOT?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @gmurnock 

 

Here is a quick demo on how to achieve this:

 

First make sure your authentication is set to "Only for Teams"

Jcook_0-1603813221000.png

 

Now inside a Topic, you want to call an action, and create a Flow. In the Flow you want to have an Input for the User Display name

Jcook_1-1603813463930.png

 

Next use a 'Search for users' action, and pass in the User input

Jcook_2-1603813532170.png

 

The outputs of this action are an array which makes it hard to pass back into PVA or any other system. So to get around this, add a 'Get user profile' action and use the first() expression to only take the first 'UserPrincipalName' from the 'Search for users' action

Here is my expression:

first(outputs('Search_for_users_(V2)')?['body/value'])?['UserPrincipalName']

GetUserProfile.png

 

Now we have all the users details, I am passing some info back to PVA to test:

PVA-Outputs.png

 

Save, and go back to the PVA canvas, next add an Action and select the Flow you created.

For the User input, select 'bot.UserDisplayName' this is available to us from the Authentication we set above. 

PVA-ActionFlow.png

 

Next I am adding a Message block, to test out the Flow.

PVA-ShowMessageUserDetails.png

 

Testing the Bot:

Success-Run.png

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

5 REPLIES 5
gmurnock
Advocate I
Advocate I

Guess I should elaborate more.  Do we have the ability to access the logged in user, User(), function from 365?  Seems crazy to have a user type in their name and email and other information when I can get it from their AzureActiveDirectory login.  Also asking the user questions in the BOT to just re-ask the same question in power Automate is NOT a very good UX.

Hello @gmurnock 

 

You can use the authentication, to get user details. Which can be passed to power automate, 

than you can use a get user action to get all the details for the user:

https://docs.microsoft.com/en-us/power-virtual-agents/advanced-end-user-authentication


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hi Jcook, for bots created in PVA Teams app, you get the end user's name and ID directly because the authentication is set to 'Only for Teams' by default:

https://docs.microsoft.com/en-us/power-virtual-agents/advanced-end-user-authentication

 

For email, you could use the ID and call a PAuto flow with Office 365 connector to retrieve it. 

Hi @gmurnock 

 

Here is a quick demo on how to achieve this:

 

First make sure your authentication is set to "Only for Teams"

Jcook_0-1603813221000.png

 

Now inside a Topic, you want to call an action, and create a Flow. In the Flow you want to have an Input for the User Display name

Jcook_1-1603813463930.png

 

Next use a 'Search for users' action, and pass in the User input

Jcook_2-1603813532170.png

 

The outputs of this action are an array which makes it hard to pass back into PVA or any other system. So to get around this, add a 'Get user profile' action and use the first() expression to only take the first 'UserPrincipalName' from the 'Search for users' action

Here is my expression:

first(outputs('Search_for_users_(V2)')?['body/value'])?['UserPrincipalName']

GetUserProfile.png

 

Now we have all the users details, I am passing some info back to PVA to test:

PVA-Outputs.png

 

Save, and go back to the PVA canvas, next add an Action and select the Flow you created.

For the User input, select 'bot.UserDisplayName' this is available to us from the Authentication we set above. 

PVA-ActionFlow.png

 

Next I am adding a Message block, to test out the Flow.

PVA-ShowMessageUserDetails.png

 

Testing the Bot:

Success-Run.png

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

Jcook
Super User III
Super User III

Hi @gmurnock 

 

Could you let us know if you issue has been solved?

 

Please try my solution above. Thanks


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Helpful resources

Announcements
March Update

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Virtual Agents innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

New Super Users

Meet the Power Virtual Agents Community Super Users!

Congratulations to our Season 1 2021 Super User Crew!

Top Solution Authors
Top Kudoed Authors
Users online (74,117)