Microsoft Teams #NeedHelp trigger

A while ago I came across an interesting question on the Power Users forum. The requirement was to trigger a flow based on a keyword in a Microsoft Teams channel message. In this example I am creating a ServiceNow incident based on the #NeedHelp keyword.

Original request

I am trying to trigger a new email off of a flow that would look for keywords in a new Teams message.

Teams trigger on keyword

indexOf function

Turns out this can easily be solved by using a trigger condition expression. The expression is using a combination of the indexOf, equals and not functions.

IndexOf searches for a string in a text. When it returns -1 it wasn’t able to find the string. This is why we also need an equals and a not function to compare it to the -1 value. Below is a sample expression.

ServiceNow use case

You could for instance use this expression to setup a flow for the IT support team to provide early support to Microsoft Teams users of a new Microsoft Team. Whenever somebody types the keyword #NeedHelp an Incident request will be registered in ServiceNow.



#NeedHelp flow setup

1. Add a for a When a new channel message is added trigger action.

2. Go to the settings of the trigger action. Add the following expression as a trigger condition.


3. Add a ServiceNow Create Record action. Configure it to use the dynamic values of the original Microsoft Teams chat message from the trigger action. In this example I used the displayName, content, id for different Incident fields. Below is a mapping of that.


Happy testing!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.