Getting the Most out of Microsoft Teams

The Microsoft Teams plugin for InsightConnect has many different uses across all types of workflows, from triggering workflows on custom messages to managing channels, teams, and users within the tool itself. And because it’s so widely applicable (and can be a little tricky to configure at times), we wanted to create this topic as the go-to place to ask questions and share knowledge regarding the Teams plugin and its usage.

So if you have any questions regarding configuration or usage of the Microsoft Teams plugin, or if you’ve got any handy tips and tricks for it that you’d like to share with others, feel free to post here!

We also wanted to share some of our own expertise when it comes to setting up and getting the most out of this plugin, so read on for more details on Microsoft Teams connections and actions.

Connections

We have a full connection guide that details the setup of the connection for Microsoft Teams. This is a good place to start if you’re looking for an end-to-end walkthrough of the connection configuration.

Important Notes

  • To configure the connection, you can start by creating a new user in Azure. This must be a non-federated user on the .onmicrosoft.com domain, and MFA must be disabled.
  • The user must be provisioned a license for Microsoft Teams.
  • Once this user is created, Microsoft requires a password change upon initial login. You can login at portal.office.com to update this password. Be sure to keep note of it (in a secure manner, such as a password manager) since it will be used later.
  • You must also create a new App Registration at portal.azure.com. Because this can require higher levels of permissions in Azure, you may need to reach out to your IT or infrastructure teams to get assistance with this.
    • Check out our walkthrough on the permissions you need to configure within this new Application. This will ensure the plugin can function correctly in InsightConnect.

Common Issues

  • AADSTS50126: Error validating credentials due to invalid username or password. This error can indicate that the Azure user account is federated. A non-federated user account is required for this connection.
  • Authentication to Microsoft Graph failed. If you have not manually logged in to the new user account at portal.office.com to update the password, this error can occur during connection tests. Try logging in to reset the password, update the credential in InsightConnect, then rerun the connection test.
  • Unnecessary Application permissions. If you’ve added any permissions to the registered app outside of the ones listed in our documentation, this can cause conflicts and result in failed plugin functionality. Ensure that the configured permissions align with the ones noted in the documentation.

Keep reading down below for additional info on Microsoft Teams triggers and actions!

4 Likes

Triggers & Actions

If you’re looking to get some more details on the triggers or actions available for Microsoft Teams, check out our documentation. You can select the respective “Triggers” or “Actions” items on the left-hand menu and browse each of the available options to see helpful descriptions and example inputs.

Important Notes

  • It can take up to 90 seconds for a message entered in Microsoft Teams to be acknowledged or acted upon by the workflow in InsightConnect. If you’re not getting an immediate response, try waiting a little longer before troubleshooting.
  • When using the “Add Member to Channel” action, the channel being used must be private. If the channel is not private, you may see a 400 Bad Request response.
  • If the Teams plugin action that you’re using requires a team name as an input, make sure your team name is unique. If there are multiple of that team name in your environment, the correct one may not be used when the plugin carries out its actions.

Tips & Tricks

Pretty Messages

If you want to beautify the messages your workflow is posting to Microsoft Teams, check out the “Send HTML Message” action. You can do the following:

  • Take a chunk of markdown that you have (say, from an InsightConnect artifact).
  • Use the “Markdown to HTML” action from the Markdown plugin to convert it to HTML.
  • Take the output of that plugin and use it in the “Send HTML Message” with Microsoft Teams. And bam! You have a lovely, readable message with a ton of good info. (This is courtesy of one of our fellow InsightConnect users!)

Regexes

The actions that offer use of regular expressions (like “Get Teams”) use Python-specific regexes. Check out https://regex101.com/ to test your regular expressions (and be sure to select Python as the “Flavor” on the left).

  • If you want the commands you enter in Teams to be fairly flexible and user-friendly, try using (?i) in your regexes. This will start “case-insensitive mode” and make it so you don’t have to remember whether to capitalize certain pieces of your commands.

HTML Cleanup

There are cases where the content extracted from the body of a Teams message can contain HTML. This may result in subsequent steps failing to parse that content because of the HTML tags. To fix this, you can:

  • Use the “Text” action from the HTML plugin to strip those tags and be left with the text content from the Teams message.
  • We do this in workflows on the Extension Library so we can ensure all message content is good-to-go for parsing and other subsequent steps.

Got some questions about other Microsoft Teams actions, or some of your own tips & tricks you want to share? Feel free to post here!

4 Likes