MoreBeerMorePower

Power Platform中心だけど、ノーコード/ローコード系を書いてます。

Calling Flow bot from Teams channel conversation

f:id:mofumofu_dance:20210719160941p:plain

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.

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.

f:id:mofumofu_dance:20210719151056p:plain

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']

f:id:mofumofu_dance:20210719154034p:plain

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.

f:id:mofumofu_dance:20210719155735p:plain

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 :)