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.
I am trying to trigger a new email off of a flow that would look for keywords in a new Teams message.
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.