Create advanced bot scenarios with Power Automate and Microsoft teams
Power Automate has supported a wide range of actions helping you achieve complex automation scenarios within Microsoft Teams. We’re excited to announce two new bot actions that have been highly requested which will help take your flows a step further.
- Update adaptive card messages in Teams
- Trigger a flow when an adaptive card action is submitted
Update Adaptive card in a chat or channel message
This action allows makers to update a Flow bot message which contains an adaptive card . Allowing you to make updates to reflect the latest changes in near real time to Microsoft Teams. For instance, if you’re using a flow to notify you when a task changes status, you could now simply update an existing message with the latest status instead of sending a new message each time. Or if you’re using an adaptive card to collect information from a user, you can choose to customize and update the card based on their response.
The message ID is the ID of the original message that posted the adaptive card. You can only update messages sent by the Flow bot on your behalf and cannot update other Flow bot messages.
Trigger a flow when an adaptive card response is submitted
Until today, you could only use Power Automate to collect a single response from one user when posting an adaptive card using the “Post an adaptive card and wait action”. We’re now introducing a new trigger that takes this a step further and lets you collect inputs from multiple users across a group chat or channel. This is achieved using a new property we’ve added to the “Post a card in chat or channel” action that tracks the card id and can be used in conjunction with a new trigger “When someone responds to an adaptive card” to collect information from any user who acts on the card.
Note that this requires the use of two flows to achieve this scenario, a listener flow that uses the new trigger and a sender flow that sends the message in the chat or channel. The listener flow should ideally be created first to avoid missing responses that come in after sending the card using the sender flow.
Example: Using Power Automate and Teams to check which of your colleagues are in the office
In today’s Hybrid work environment, it can be hard to tell who is in office or working remotely from day to day. These set of flows send an adaptive card daily to get details on who is in office, so team members can meet up for a quick lunch or discussion.
It uses two flows one to post a card in a channel that can be either triggered manually or daily using a scheduled trigger. This posts a poll in the channel to get information from users in the office and stores it in a specific tag in Teams that the user created ahead of time. It also updates the card with the results after an hour. Below is an overall structure of the flow and the specific post a card action with the card type id set
The other flow listens to this card type id and updates the tag with the users in the office. The general flow structure and trigger are shown below. Note that the card id is the same as the one used in the sender flow.
At the end of the hour the sender flow uses the new “Update a card action” to update the flow with the details on the users who are in office on the given day.
Check out the Microsoft Teams connector page for more details on the new trigger and actions. The above example just a glimpse of what’s possible checkout other Power Automate Teams templates and learn to build your own flows to achieve even more. We’re excited to hear about what you build.