The Microsoft Teams Bot integration allows you to trigger Torq workflows and interact with Teams users, teams, channels, and messages. You can also create a bot that posts messages, tags users with the @ command, and more.
After setup, you can either mention the bot in a chat or send a direct message. In a chat, you can describe your request in free text (e.g., "check IP address") or select a command from the command list, which you'll create in this tutorial.
Torq enables quick and easy integration with the Microsoft Teams bot, so you can automate anything and everything within moments. Torq's public Teams Bot steps include:
Ask a Question
Get Channels
Get Users
Post Adaptive Card
+7 more...
As always, if you don't see a step you need, you can create your own steps using Torq's custom step builder and share them within your workspace or organization.
Use Microsoft Teams Steps in Torq - Create a Torq Bot in Teams
The Torq Teams bot is a Teams app to which you assign bot capabilities. You can use the bot to send users and channels unidirectional messages or questions that expect user responses.
You can also create one or more commands that users can execute within a chat to trigger Torq workflows. For example, if you add a command called check-ip
, you can define the trigger condition only to apply when that command is used in a chat.
Step One: Create a Custom Apps Policy in Microsoft Teams
The custom apps policy allows the user creating the bot to install custom apps for their team, including the Torq Bot. If the user already has the required permissions or a custom apps policy with the necessary permissions exists, you can skip this section and proceed directly to Step Two: Create a Bot.
Note that you must be a Teams admin to create a custom apps policy.
In Teams Admin Console: Log in to your Teams admin console, navigate to Teams Apps > Setup Policies, and click Global (org-wide default).
Upload Custom Apps: Confirm that Upload Custom Apps is set to On.
New Policy: If the policy is set to Off, create a new custom app policy.
Apply Custom Policy: Apply the custom policy to the admin-level user who will create the bot.
Step Two: Create a Bot in Microsoft Teams Dev
The user creating the bot must be an admin in Microsoft Teams.
Create a New App: Go to https://dev.teams.microsoft.com and click Apps > New app.
Name App: Give the app a relevant name.
Basic Information: Fill out the following information:
Short Name:
Torq Bot
App ID: This is auto-generated; copy it for later use in Torq. If you forget to copy it, you can access it again as described here in step 2.b.
Short description:
Torq Security Automation Bot
Long description:
Torq’s no-code automation modernizes how security and operations teams work with easy workflow building, limitless integrations, and numerous prebuilt templates.
Developer information, company name: torq.io
Developer information, website:
https://torq.io/
App URLs, privacy policy:
https://torq.io/privacy
App URLs, terms of use:
https://torq.io/terms-conditions
Application (Client) ID:
Branding: Within the app, go to Configure > Branding. Branding enables you to upload custom icons for the app/bot, which will be displayed when messages are sent to users and groups. You might want to add your company's logo/icon.
Upload an image for the Color icon. This is displayed in the store and most other places. The icon must be 192x192 pixels in total, with a 96x96-pixel symbol in the center.
Upload an image for the Outline icon. This displays on the left side of Teams when the app is in use. The icon must be 32x32 pixels and either white or transparent.
Configure Bot Features: Go to Configure > App Features and click Bot.
Click Create new bot.
Click +New Bot, enter a name for the bot, and click Add.
Click the new bot you made and click Configure.
In the Bot endpoint address field, enter
https://teams-app.torq.io/teams/v1/interactivity-hooks
if the URL for your Torq application portal is https://app.torq.io (your organization is US-based). Enterhttps://teams-app.eu.torq.io/teams/v1/interactivity-hooks
instead if the URL for your Torq application portal is https://app.eu.torq.io (your organization is EU-based).Click Save.
Go to Client Secrets and click Add client secret for your bot. Copy the generated secret and save it in a secure location for later.
Return to Your App: Return to the Apps section and click the app you created earlier.
Return to Bot Card: Within the app, click Configure > App features and click the existing Bot card you created earlier.
Define Bot:
Under What can your bot do? select desired scopes (we recommend at least Upload and download files).
Under Select the scopes where people can use your bot, select all of the scopes (Personal, Team, and Group Chat).
Finalize: Click Save, and then click Publish and select Publish to your org.
Step Three: Grant the App Permission in the Teams Admin Portal
After publishing your app, you must have an admin approve the app in the Teams Admin portal.
Navigate to Admin Portal: Go to the Teams Admin Portal and go to Teams apps > Manage apps.
Find App: In the search box for the table, search for the Teams app name you created earlier.
Publish App: On the application, click Publish.
Step Four: Grant the App Permission in the Azure Portal
The permissions granted to the app determine which actions you can perform as steps in Torq workflows.
Navigate to Azure Portal: Go to your Azure portal and navigate to App registrations.
Find your App: Search for your bot - it will have the same name.
Overview: Copy the Directory (tenant) ID and save this for later.
Allow Accounts: Click Supported account types, and then under Who can use this application, select Accounts in any organizational directory/Multitenant.
Enable Permissions: Go to Manage > API permissions, click +Add a permission > Microsoft Graph > Application permissions and add the following permissions.
AppCatalog.Read.All
Group.Read.All
TeamsAppInstallation.ReadWriteForTeam.All
TeamsAppInstallation.ReadWriteForUser.All
User.Read.All
The following permissions are optional but should be added if you plan to use this Microsoft Teams Bot integration with both Microsoft Teams Bot steps and Microsoft Teams steps (Microsoft Teams steps are also compatible with the Microsoft 365 integration):
Channel.ReadBasic.All
Chat.ReadWrite.All
Team.ReadBasic.All
TeamsAppInstallation.ReadForUser.All
Finalize: Click Add permissions and then Grant admin consent.
Step Five: Create Bot Commands
Before you create bot commands, determine the actions you want your users to be able to perform from within a chat. In Torq, the command name will trigger a workflow.
For example, if you create a command called check-ip
, each time that command is used in a chat, it will trigger a workflow that parses the IP address sent in the chat and submits it for analysis. The workflow can then return the analysis results to the same (or a different) chat.
Go to Microsoft Teams Dev Portal: In the Teams Developer Portal, go to your Apps and select the app you created. Go to App features > Bot.
Create a Command: Click Add a command, configure the command, and click Add a command.
Optionally Add More: Optionally, add more commands by clicking Add a command.
Step Six: Create a Microsoft Teams Bot Integration in Torq
Navigate to Integration: Go to Build > Integrations > Steps > Microsoft Teams Bot, and click Add.
Fill in Details:
Integration name: Enter a unique and meaningful name
Microsoft Teams Bot Client ID: Navigate to your Azure portal and click App registrations. Click the app for your Torq bot, and under the Overview page, copy the value for the Application (client) ID.
Microsoft Teams Bot Client Secret: You must have copied this value to a safe location when creating the Bot. It was available in step 5f.
Microsoft Teams App ID: Navigate to dev.teams.microsoft.com. In the app you created earlier, click Basic Information. Copy the value under App ID.
Microsoft Tenant ID: Navigate to aad.portal.azure.com, and under your tenant, click App Registrations. Click the app for your Torq bot and copy the value for the Directory (tenant) ID.
Finalize: Click Add.
FAQs
Some Microsoft Teams Bot steps require an authentication token, while others require an integration instance. Make sure you add the Generate Microsoft Teams Bot API Token step (from Microsoft Teams Bot section, not Microsoft Teams) before other Teams Bot steps so you can pass the generated token in subsequent required steps.
After you publish the Torq Teams App to your organization, it may take several hours to appear in the Teams admin portal because Microsoft needs time to propagate the application across your infrastructure.
Templates
Now that you've added the integration, check out these templates specially crafted by Torq's security experts. Visit Torq's template library for more.