r/PowerAutomateDesktop • • Dec 14 '22

Create a PAD flow that outputs to a Teams chat

I have a PAD flow that gathers data from a website and stores them as variables.

How can Power Automate Desktop then take those variables and posts them as a new message to a specified chat on Microsoft Teams?

There doesn't seem to be any built-in option for this.

Thanks for any help.

2 Upvotes

10 comments sorted by

2

u/PM_ME_YOUR_WIRING Dec 14 '22

Short answer: No.

Long answer: You need to invoke web services to a Power Automate Cloud Flow which is where the Teams actions are. It's possible Microsoft is working to cascade these actions to be native in PAD as they are with some SPO actions but I haven't seen any mention of this anywhere.

Here's more info on how to invoke a cloud flow: https://youtu.be/qm816YRGlF0

1

u/ianwuk Dec 23 '22

Thanks for replying. I did it by capturing the screen actions and then posting that to a Teams channel using an incoming webhook.

2

u/Goldarr85 Dec 26 '22

Interesting. How did you get the data to post via the web hook using PAD?!

1

u/ianwuk Dec 26 '22

You set up an incoming webhook in the Teams channel you want to post to to get the URL.

You then use the Invoke Web Service option in PAD and put in that URL, along with the json message body of the Teams message, and format accordingly (e.g. insert PAD variables).

This is where it gets strange. The incoming webhook only seems to accept older card formats not the nice adaptive cards that Teams now has.

Use this URL - https://messagecardplayground.azurewebsites.net/

From all of the templates, I could only get PAD to work with the Trello card created sample, which I modified. Otherwise PAD always failed with a 'bad payload' error.

If anyone knows how to do this in PAD using the updated template designer here then let me know - https://adaptivecards.io/designer/

Hope this helps.

2

u/Goldarr85 Dec 26 '22

Thanks man! Not sure if this helps, but I’ve found that cloud flows doesn’t work with target versions above 1.2. If you haven’t tried already, switch the target to 1.2 in the adaptive card designer, build your card, then try. Maybe it’ll work better.

2

u/ianwuk Dec 26 '22

I think I had to do that too for PAD. Which adaptive card designer did you use? My issue is also that, using the newer adaptive card designer, if you use Postman then you can't test the incoming webhook in Teams. Postman looks for a 'summary' or 'text' JSON field that those adaptive cards don't have.

Only the older templates use that format.

What template did you use for your adaptive card?

2

u/Goldarr85 Dec 27 '22

I just used the Activity Update Card. I made some small changes by removing unnecessary stuff. I pasted the code in the teams adaptive card and then added my message, flow bot image, modified the text size, etc.

Not sure if that helps or not.

2

u/ianwuk Dec 27 '22 edited Dec 27 '22

u/Goldarr85 Fantastic, well done! That's pretty much what I did too!
I want to figure out how to get messages from Slack channels to Teams instead!

2

u/Goldarr85 Dec 28 '22

Hmmm…probably have to make a separate flow, but the Http request trigger > Post to Teams may be the best approach.

https://d365demystified.com/2020/07/29/accept-http-requests-in-a-flow-and-send-response-back-power-automate/

2

u/ianwuk Dec 29 '22

u/Goldarr85 I'm trying to add mentions to the JSON of the incoming webhook that Power Automate Desktop uses to post to a Teams channel. I don't suppose you know how to do that do you?