The Flow bot can post messages and Adaptive Cards to Teams, as well as execute some instant flows from a 1:1 chat it.
It is also possible to run a flow from a channel's chat message by using "For a selected message" trigger, but this requires interacting with the message's menu, which is not user-friendly:(
In this post, I will show a new pattern to call the Flow bot from a channel's chat interface.
Flow Trick: Start conversation with flow bot in channel😎#PowerAutomate x #MicrosoftTeams pic.twitter.com/ymzbmk6REn
— Hiro (@mofumofu_dance) 2021年7月15日
New Trigger : "When keywords are mentioned"
The most important point of this pattern is to use a new trigger "When keywords are mentioned" in Teams connector.
This trigger will be executed when the specified keyword is included in a channel conversation or group chat message, and will return the target message ID. Unlike other polling triggers, it reacts immediately to message postings.
To get the details of the triggered message, use the "Get message details" action. In this case, the channel ID and message ID are obtained from trigger body using the following expressions:
ChannelId: first(triggerBody()?['value'])?['channelId'] MessageId: first(triggerBody()?['value'])?['messageId']
If you want to use the message body of the trigger to process subsequent flows, put a branching operation after this action.
Response from Flow bot
Another option is to have the Flow bot present a menu. In this case, after retrieving the message details, insert the action "Post adaptive card and wait for a response" and include the input controls needed for subsequent processing in the card.
This pattern - Keyword trigger -> Get message details -> Post adaptive card - allows you to establish a pseudo-conversation with the Flow Bot on the channel's chat and execute the flow.
See the following demo again :)
Flow Trick: Start conversation with flow bot in channel😎#PowerAutomate x #MicrosoftTeams pic.twitter.com/ymzbmk6REn
— Hiro (@mofumofu_dance) 2021年7月15日