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

Sentiment Analysis with Desktop Flows?

Hello, we need to use the AI Builder Sentiment Analysis functionality with a desktop flow.  We have AI Builder credits available for this, and this works with cloud flows, but we are not seeing a way to use Sentiment Analysis with desktop flows?  There is the Cognitve>Microsoft>Text Analysis>Sentiment action in Power Automate Desktop, but this seems to only use Microsoft Cognitive Services (versus AI Builder).  

 

Is there a way to use AI Builder Sentiment Analysis with desktop flows?

1 ACCEPTED SOLUTION

Accepted Solutions
JoeF-MSFT
Power Apps
Power Apps

Hi @drake,

 

Thanks for posting this question.

You can’t call yet AI Builder models directly from Power Automate Desktop but there is a workaround you can use by calling a cloud flow from a desktop flow. Here is how to do it:

1. Create a cloud flow like the following one with the ‘When a HTTP request is received’ trigger, the AI Builder sentiment analysis action and a Response action that will return the Overall text sentiment.

JoeF-MSFT_1-1616708655325.png


2. From the desktop flow use the Invoke web service action and use as URL the one you will get once you save your cloud flow on the HTTP POST URL field on the trigger. Set the method to POST.

Important! When you paste the URL in Power Automate Desktop, you will need to put an extra percentage sign (%) next to the percentage signs already in the URL. So if in your URL have something like this &sp=%2Ftriggers, when you paste it in Power Automate Desktop you will need to put &sp=%%2Ftriggers

JoeF-MSFT_2-1616708717865.png

 

JoeF-MSFT_3-1616708782547.png

 

3. The sentiment analysis result returned by the cloud flow will be in the WebServiceResponse flow variable from the Invoke web service action.

PAD Sentiment 2.gif

Hope this helps!

View solution in original post

5 REPLIES 5
JoeF-MSFT
Power Apps
Power Apps

Hi @drake,

 

Thanks for posting this question.

You can’t call yet AI Builder models directly from Power Automate Desktop but there is a workaround you can use by calling a cloud flow from a desktop flow. Here is how to do it:

1. Create a cloud flow like the following one with the ‘When a HTTP request is received’ trigger, the AI Builder sentiment analysis action and a Response action that will return the Overall text sentiment.

JoeF-MSFT_1-1616708655325.png


2. From the desktop flow use the Invoke web service action and use as URL the one you will get once you save your cloud flow on the HTTP POST URL field on the trigger. Set the method to POST.

Important! When you paste the URL in Power Automate Desktop, you will need to put an extra percentage sign (%) next to the percentage signs already in the URL. So if in your URL have something like this &sp=%2Ftriggers, when you paste it in Power Automate Desktop you will need to put &sp=%%2Ftriggers

JoeF-MSFT_2-1616708717865.png

 

JoeF-MSFT_3-1616708782547.png

 

3. The sentiment analysis result returned by the cloud flow will be in the WebServiceResponse flow variable from the Invoke web service action.

PAD Sentiment 2.gif

Hope this helps!

View solution in original post

@JoeF-MSFT thanks that worked!  But how would this work with the "Detect the language being used in text" action, which I will need to use in conjunction with the detect sentiment action?  It returns this error:

 

"The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach."

 

I attempted to use this expression in the Reponse action, but it did not work either:

 

first(outputs('Detect_the_language_being_used_in_text')?['body'])?['language']

 

drake_1-1616787386827.png

 

 

JoeF-MSFT
Power Apps
Power Apps

Great @drake !

Would having language detection + sentiment analysis in the same cloud flow work? If so you can build it like this:

JoeF-MSFT_0-1616790777484.png

This would be the expression to use: 

first(outputs('Detect_the_language_being_used_in_text')?['body/responsev2/predictionOutput/results'])?['language']
drake
Advocate I
Advocate I

@JoeF-MSFT your example worked perfectly, but how did you know to use this:

 

?['body/responsev2/predictionOutput/results'])

 

I don't see where this string is displayed in the Power Automate UI anywhere.

JoeF-MSFT
Power Apps
Power Apps

Good question @drake🙂

I built a simple cloud flow where the language output from the language detection action is added to an 'Apply to each' loop. I then hover the mouse over the 'results' output to see how to reference this array in an expression:

JoeF-MSFT_0-1616800327490.png


I do the same to check the name for the language output:

JoeF-MSFT_1-1616800431118.png

 

Hope this helps! 

 

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (53,478)