Skip to main content

Microsoft Teams

Connect Microsoft Teams to Squid to enable AI-powered messaging

The Teams connector's functionality

The Teams connector currently supports:

  • Searching conversations across teams and channels using AI-powered knowledge base search.
    • By providing AI agents with these capabilities, users can ask the AI agent to search for relevant conversations, and the agent will retrieve intelligent results.
  • Users may message the AI agent from Teams (via @mentions or direct messages), and the Teams connector will relay the agent's response directly within Teams.
  • Reading all conversations from teams and channels into a knowledge base to enable users to ask the AI agent for intelligent searches or summaries.
  • The connector currently only supports "Single Tenant" application setups, not "Multitenant". If you need support for multitenant, let us know!

Configuring the Teams connector

Squid connects to a Microsoft Teams application (via Azure App Registration) to read messages and interact with your Teams workspace.

Creating a Teams application and Azure App Registration

  1. Navigate to the Azure Portal and go to App registrations.
  2. Click New registration and provide a meaningful app name.
  3. Under Supported account types, select Single Tenant.
  4. After creation, note down the Application (client) ID and Directory (tenant) ID.
  5. Go to Certificates & secrets and create a new client secret. Save this value securely as it won't be shown again.
  6. Go to API permissions and add the necessary Microsoft Graph permissions:
    • Team.ReadBasic.All - To read team information
    • Channel.ReadBasic.All - To read channel information
    • ChannelMessage.Read.All - To read messages from channels
    • Chat.Read.All - To read chat messages (if supporting DMs)
  7. Grant admin consent for these permissions.

Adding the Teams connector to your Squid application

  1. Navigate to the Squid Console and select the Connectors tab.

  2. Switch to the Available Connectors tab and add a Microsoft Teams connector.

  3. The configuration details can be found from your Azure App Registration:

    Connector ID: A meaningful string that uniquely identifies the connector in the code. Note this ID because you will need it later.

    Client ID: The Application (client) ID from your Azure App Registration, which can be found on the Overview tab.

    Tenant ID: The Directory (tenant) ID from your Azure App Registration, which can be found on the Overview tab.

    Client Secret: The client secret value you created in the Certificates & secrets section. This is used to authenticate requests to the Microsoft Graph API.

    Index Channels: Whether Squid should read all messages (from the teams and channels the bot has access to) to offer intelligent searches and summaries.

    Message History Limit: When messaging Squid via Teams, Squid will read this many prior messages to provide itself enough context to best answer the user.

Create a corresponding AI Agent to use with Teams

  1. Navigate to the Squid Console and select the Agent Studio tab.
  2. Click Create New Agent and create the agent. Note the Agent ID because we will need it later.
  3. On the new agent's Overview tab, click Add Abilities and expand the Microsoft Teams entry to add the Teams connector you just created.

Creating a Teams Bot (for interactive messaging)

  1. Navigate to the Azure Portal and search for Azure Bot.
  2. Create a new Azure Bot resource.
  3. Set Type of App to Single Tenant.
  4. Link it to your App Registration created above by selecting Use existing app registration.
  5. Create the bot.
  6. Get the Messaging endpoint URL from Squid.
    • Navigate to the Squid Console.
    • Select the Backend tab on the sidebar.
    • Select the Webhooks tab.
    • Copy the URL for the teamsNotification webhook, which should look like https://{your-app-id}.{your-region}.squid.cloud:8001/webhooks/teamsNotification
    • Append this to the URL ?integrationId={your-teams-connector-id}&agentId={your-squid-agent-id} so that the final URL looks like:
      • https://{your-app-id}.{your-region}.squid.cloud:8001/webhooks/teamsNotification?integrationId={your-teams-connector-id}&agentId={your-squid-agent-id}
  7. Go to your newly-created Azure Bot and navigate to SettingsConfiguration.
  8. Copy your Squid webhook URL into the Messaging endpoint field.
  9. Navigate to SettingsChannels, find Microsoft Teams from the Available Channels and add it to the bot.

Create app package and upload to Teams

  1. Create a Teams app package, which is a ZIP file containing three files: manifest.json, color.png, and outline.png.

    • You may start with this manifest.json and replace all occurences of YOUR_APPLICATION_CLIENT_ID with your Application (client) ID.
    • The PNG icons are also available: color.png and outline.png
    • Just create a ZIP file with these three files at the top level.
  2. Upload to Teams. You have two options:

    Option A: Upload via Teams Client

    1. Open Microsoft Teams
    2. Go to AppsManage your apps
    3. Click Upload an appUpload a custom app
    4. Select your ZIP file.
    5. Click Add to install in your organization.

    Option B: Upload via Teams Admin Center

    1. Go to Teams Admin CenterTeams appsManage apps
    2. Click Upload new app
    3. Select your ZIP file.
    4. Configure app settings and permissions as needed.

Using the Teams connector in your application

There are three ways to use the Teams connector in your application:

  1. Using the Agent Studio: If you are using the Agent Studio to create your AI agent, you can add the Teams connector by clicking the Add Abilities button and adding the Microsoft Teams ability. Learn more about abilities here. After adding the ability, you can ask your agent to search Teams messages in the Test Agent tab. Note: please allow a couple of hours for Squid to index the Teams messages.

    Example messages:

    • Search Teams for conversations about the product launch
    • Show me all discussions in the Engineering team about API design
    • Find messages in the Finance channel about budget planning
  2. Using the Squid SDK: If you are using the Squid SDK to create your AI agent, you can use the squid.ai().agent('AGENT_ID').ask() function to chat with your agent. Learn more here. Use the Teams connector by adding it in the connectedIntegrations option of the ask() function.

await this.squid.ai().agent('AGENT_ID').ask('Search Teams for discussions about the new feature', {
connectedIntegrations: [{
integrationId: 'TEAMS_CONNECTOR_ID',
integrationType: 'teams',
description: 'Call this connector to search Microsoft Teams messages',
}],
});
  1. Using the NPM package: If you use @squidcloud/teams-client, you can:
  // Initialize the client.
const teamsClient = SquidTeamsClient(this.squid, 'TEAMS_CONNECTOR_ID');

// Search for messages related to your query.
await teamsClient.searchMessages({
teamNames: 'Engineering,Product',
channelNames: 'general,announcements',
prompt: 'API design discussions'
});