Skip to content

Microsoft Teams

The Teams message source type receives outgoing webhook requests from Microsoft Teams. Users of Teams can use @mentions to trigger a request. Your Automation return value is then sent back to the conversation as a response.

For each Teams Message source you supply a Name. This is the text that users will type in Teams (preceded by an @ sign). For example: You could have a Teams Message Source with the name 'FindCustomer'. In Teams users would type @FindCustomer followed by some more text. When the user hits enter the text will be sent to ThinkAutomation and your Automation will execute. The Return value of the Automation will then be sent back to Teams and show as a response in the conversation.

You can create any number of Teams Message Sources with different 'names' and then attach these to any of your Teams.

Setup In Microsoft Teams

In Microsoft Teams select the appropriate team and choose Manage team from the (•••) drop-down menu.

TeamsSetup1

Select Manage Team

TeamsSetup2

Choose the Apps tab from the navigation bar.

TeamsSetup3

Select Create an outgoing webhook.

Note: This option will only be available if you are the Owner of the team.

TeamsSetup4

Specify the Name - users can then enter @{name} to send to ThinkAutomation.

Paste the Microsoft Teams Outgoing Webhook Callback URL into the Callback URL entry.

Paste the Security Token shown after the Teams webhook is created into the Security Token entry in ThinkAutomation.

TeamsSetup6

See: Add custom bots to Microsoft Teams with outgoing webhooks - Teams | Microsoft Docs for more information.

When you create a new Teams message source, ThinkAutomation will automatically add Extract Field actions to the Automation to extract the message text.

Returning A Response

Use the Return action to send back the text you want to respond with. The response text can be plain text, HTML or Markdown.

An Example: You could create a Teams outgoing webhook with the name "GetAccount". Whenever a Teams user types '@GetAccount Test Customer' - your Automation will execute. The %MessagePlainText% Extracted field will be set to 'GetAccount Test Customer'. The %MessageTextAfterName% Extracted Field will be set to 'Test Customer'. You could then lookup customer details from a database or perform other actions and return a response - which will be returned back to the Teams conversation.

You could also use the Ask AI action with a local knowledge store. This would allow teams users to send questions to your 'bot'.

Returning An Adaptive Card

You can also return an Adaptive Card. This is Json text that will be rendered in Teams. You can design Adaptive Cards here: https://adaptivecards.io . Once you have designed your Adaptive card click the Copy card payload button to copy the Json text. Use this as the Automation Return value. You can adjust the Json to include Automation %variables% before returning it using the Create Json action.

The Automation you execute should not be long running. Microsoft Teams will wait for up to 5 seconds for a response.

The Microsoft Teams message source type uses the ThinkAutomation Web API to forward messages from Teams to your ThinkAutomation Server. The ThinkAutomation Web API sends messages to your ThinkAutomation Server over a secure WebSocket connection. The Web API server does not keep copies of forwarded messages.