29 January 2021

Microsoft Flow: new Microsoft Teams triggers

Microsoft released a number of new Flow triggers for Microsoft Teams. One of them was particularly interesting for me - "When a new channel message is added (Preview)". This operation triggers when a new message is posted to a channel in a Team. It only fires when a root messages is added in the channel, replies to an existing channel message will not result in the trigger event firing.

My goal was to add trigger filter, so it will react only on specific messages. In my case it was messages starting from "start " substring. Message filtering is configured on Settings page, there is an input field called "Trigger Conditions", which currently does not have any examples or detailed description at Microsoft Docs.


It took me quite some time to figure out how to write proper condition, as it was failing with "The power flow's logic app flow template was invalid. The template condition expression is not valid template language expression" error message.

Finally the proper condition format was found, here is how it should look like when you want your Flow to react only on messages starting from "start " substring:

@equals(substring(toLower(triggerBody()?['body']?['content']), 0, 6), 'start ')