Skip to main content
Microsoft Teams Bot

Integrate a Microsoft Teams Bot with Torq to trigger workflows, manage Teams interactions, and enhance team collaboration.

Updated yesterday

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.

To trigger a Torq workflow based on events sent from Microsoft Teams, look here.

To use Microsoft Teams steps in Torq workflows, look here.

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.

  1. In Teams Admin Console: Log in to your Teams admin console, navigate to Teams Apps > Setup Policies, and click Global (org-wide default).

  2. Upload Custom Apps: Confirm that Upload Custom Apps is set to On.

  3. New Policy: If the policy is set to Off, create a new custom app policy.

    1. Go back to Setup Policies and click Add.

    2. Enter a meaningful name for the policy.

    3. Set the Upload Custom Apps setting to On.

    4. Click Save.

  4. Apply Custom Policy: Apply the custom policy to the admin-level user who will create the bot.

    1. Go to Users > Manage Users and locate the user.

    2. Hover to the left of the user's name, click the check mark icon, and click Edit settings.

    3. For App setup policy, select the policy with the Upload custom apps setting set to On.

    4. Click Apply.

Step Two: Create a Bot in Microsoft Teams Dev

The user creating the bot must be an admin in Microsoft Teams.

  1. Create a New App: Go to https://dev.teams.microsoft.com and click Apps > New app.

  2. Name App: Give the app a relevant name.

  3. Basic Information: Fill out the following information:

    1. Short Name: Torq Bot

    2. 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.

    3. Short description: Torq Security Automation Bot

    4. Long description: Torq’s no-code automation modernizes how security and operations teams work with easy workflow building, limitless integrations, and numerous prebuilt templates.​

    5. Developer information, company name: torq.io

    6. Developer information, website: https://torq.io/

    7. App URLs, privacy policy: https://torq.io/privacy

    8. App URLs, terms of use: https://torq.io/terms-conditions

    9. Application (Client) ID:

  4. 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.

    1. 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.

    2. 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.

  5. Configure Bot Features: Go to Configure > App Features and click Bot.

    1. Click Create new bot.

    2. Click +New Bot, enter a name for the bot, and click Add.

    3. Click the new bot you made and click Configure.

    4. 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). Enter https://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).

    5. Click Save.

    6. 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.

  6. Return to Your App: Return to the Apps section and click the app you created earlier.

  7. Return to Bot Card: Within the app, click Configure > App features and click the existing Bot card you created earlier.

  8. Define Bot:

    1. Under What can your bot do? select desired scopes (we recommend at least Upload and download files).

    2. Under Select the scopes where people can use your bot, select all of the scopes (Personal, Team, and Group Chat).

  9. 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.

  1. Navigate to Admin Portal: Go to the Teams Admin Portal and go to Teams apps > Manage apps.

  2. Find App: In the search box for the table, search for the Teams app name you created earlier.

  3. 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.

  1. Navigate to Azure Portal: Go to your Azure portal and navigate to App registrations.

  2. Find your App: Search for your bot - it will have the same name.

  3. Overview: Copy the Directory (tenant) ID and save this for later.

  4. Allow Accounts: Click Supported account types, and then under Who can use this application, select Accounts in any organizational directory/Multitenant.

  5. Enable Permissions: Go to Manage > API permissions, click +Add a permission > Microsoft Graph > Application permissions and add the following permissions.

    1. AppCatalog.Read.All

    2. Group.Read.All

    3. TeamsAppInstallation.ReadWriteForTeam.All

    4. TeamsAppInstallation.ReadWriteForUser.All

    5. User.Read.All

    6. 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):

      1. Channel.ReadBasic.All

      2. Chat.ReadWrite.All

      3. Team.ReadBasic.All

      4. TeamsAppInstallation.ReadForUser.All

  6. 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.

  1. 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.

  2. Create a Command: Click Add a command, configure the command, and click Add a command.

    1. Enter a name for the command. This name will be displayed in chats.

    2. Enter a description for the command that explains what the command does. This description will be displayed in chats.

    3. Select all of the scopes.

    4. Click Add.

  3. Optionally Add More: Optionally, add more commands by clicking Add a command.

Step Six: Create a Microsoft Teams Bot Integration in Torq

  1. Navigate to Integration: Go to Build > Integrations > Steps > Microsoft Teams Bot, and click Add.

  2. Fill in Details:

    1. Integration name: Enter a unique and meaningful name

    2. 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.

    3. 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.

    4. 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.

    5. 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.

  3. Finalize: Click Add.


FAQs


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.

Did this answer your question?