Microsoft Teams
Microsoft TeamsをSquidに接続してAI搭載のメッセージングを実現する
Teams connectorの機能
Teams connectorは現在、以下をサポートしています:
- AI搭載のknowledge base検索を使用して、teamsおよびchannels内の会話を検索すること。
- これらの機能をAIエージェントに提供することで、ユーザーはAIエージェントに関連する会話の検索を依頼でき、エージェントはインテリジェントな結果を返します。
- ユーザーはTeamsから(@mentionsまたはdirect messages経由で)AIエージェントにメッセージを送ることができ、Teams connectorはエージェントの応答をTeams内で直接中継します。
- teamsおよびchannelsの全会話をknowledge baseに読み込み、ユーザーがAIエージェントにインテリジェントな検索やサマリーを依頼できるようにします。
- このconnectorは現在、only "Single Tenant" アプリケーション設定のみをサポートしており、"Multitenant" はサポートしていません。もしmultitenantのサポートが必要な場合は、let us know!
Teams connectorの設定
Squidは、メッセージの読み取りとTeams workspaceとの連携のために、Microsoft Teams application(Azure App Registration経由)に接続します。
TeamsアプリケーションとAzure App Registrationの作成
- Azure Portalにアクセスし、App registrations に移動します。
- New registration をクリックし、意味のあるアプリ名を入力します。
- Supported account types の下で、Single Tenant を選択します。
- 作成後、Application (client) ID と Directory (tenant) ID をメモしておきます。
- Certificates & secrets に移動し、新しいclient secretを作成します。この値は再度表示されないため、安全に保存してください。
- API permissions に移動し、必要なMicrosoft Graphの権限を追加します:
Team.ReadBasic.All- チーム情報の読み取り用Channel.ReadBasic.All- チャネル情報の読み取り用ChannelMessage.Read.All- チャネルからのメッセージの読み取り用Chat.Read.All- チャットメッセージの読み取り用(DMをサポートしている場合)
- これらの権限に対してadmin consentを付与します。
SquidアプリケーションにTeams connectorを追加する
-
Squid Consoleにアクセスし、Connectors タブを選択します。
-
Available Connectors タブに切り替え、Microsoft Teams connectorを追加します。
-
設定の詳細は、Azure App Registrationから確認できます:
Connector ID: コード内でconnectorを一意に識別するための意味のある文字列です。このIDは後で必要になるため、メモしておいてください。
Client ID: Azure App RegistrationのOverviewタブにあるApplication (client) IDです。
Tenant ID: Azure App RegistrationのOverviewタブにあるDirectory (tenant) IDです。
Client Secret: Certificates & secretsセクションで作成したclient secretの値です。これはMicrosoft Graph APIへのリクエストを認証するために使用されます。
Index Channels: Squidが、ボットがアクセス可能なteamsおよびchannelsからすべてのメッセージを読み取り、インテリジェントな検索およびサマリーを提供するかどうか。
Message History Limit: Teams経由でSquidにメッセージを送る際、Squidがユーザーへの最適な回答をするために十分な文脈を得るため、過去のメッセージを何件読み込むかの設定です。
Teamsで使用する対応するAI Agentの作成
- Squid Consoleにアクセスし、Agent Studio タブを選択します。
- Create New Agent をクリックしてエージェントを作成します。Agent IDは後で必要になるため、メモしておいてください。
- 新しいエージェントのOverviewタブで、Add Abilitiesをクリックし、Microsoft Teamsのエントリーを展開して、先ほど作成したTeams connectorを追加します。
Teams Botの作成(インタラクティブなメッセージング用)
- Azure Portalにアクセスし、Azure Botを検索します。
- 新しいAzure Botリソースを作成します。
- Type of AppをSingle Tenantに設定します。
- Use existing app registrationを選択して、上記で作成したApp Registrationにリンクします。
- Botを作成します。
- SquidからMessaging endpointのURLを取得します。
- Squid Consoleにアクセスします。
- サイドバーでBackendタブを選択します。
- Webhooksタブを選択します。
teamsNotificationwebhookのURLをコピーします。URLはhttps://{your-app-id}.{your-region}.squid.cloud:8001/webhooks/teamsNotificationのようになります。- このURLに
?integrationId={your-teams-connector-id}&agentId={your-squid-agent-id}を追加し、最終的なURLを次のようにします:https://{your-app-id}.{your-region}.squid.cloud:8001/webhooks/teamsNotification?integrationId={your-teams-connector-id}&agentId={your-squid-agent-id}
- 作成したAzure Botに移動し、Settings → Configurationにアクセスします。
- Squidのwebhook URLをMessaging endpointフィールドにコピーします。
- Settings → Channelsに移動し、Available ChannelsからMicrosoft Teamsを見つけ、Botに追加します。
アプリパッケージの作成とTeamsへのアップロード
-
Teams app package を作成します。これは、
manifest.json、color.png、およびoutline.pngの3つのファイルを含むZIPファイルです。- このmanifest.jsonから始め、
YOUR_APPLICATION_CLIENT_IDの全てをApplication (client) IDに置き換えます。 - PNGアイコンも利用可能です: color.png および outline.png
- これら3つのファイルがトップレベルにあるZIPファイルを作成してください。
- このmanifest.jsonから始め、
-
Teamsにアップロードします。オプションは2通りあります:
オプション A: Teams Clientを介してアップロード
- Microsoft Teamsを開きます。
- Apps → Manage your apps に移動します。
- Upload an app → Upload a custom app をクリックします。
- ZIPファイルを選択します。
- Add をクリックして、組織にインストールします。
オプション B: Teams Admin Centerを介してアップロード
- Teams Admin Center → Teams apps → Manage apps に移動します。
- Upload new app をクリックします。
- ZIPファイルを選択します。
- 必要に応じてアプリの設定と権限を構成します。
アプリケーションでTeams connectorを使用する
アプリケーションでTeams connectorを使用する方法は3つあります:
-
Using the Agent Studio: Agent Studioを使用してAIエージェントを作成している場合、Add AbilitiesボタンをクリックしてMicrosoft Teams abilityを追加することでTeams connectorを組み込むことができます。Learn more about abilities here。abilityを追加した後、Test AgentタブでエージェントにTeamsメッセージの検索を依頼できます。注意: SquidがTeamsメッセージのインデックスを作成するのに数時間かかる場合があります。
例:
Search Teams for conversations about the product launchShow me all discussions in the Engineering team about API designFind messages in the Finance channel about budget planning
-
Using the Squid SDK: Squid SDKを使用してAIエージェントを作成している場合、
squid.ai().agent('AGENT_ID').ask()関数を使用してエージェントとチャットできます。Learn more here。ask()関数のconnectedIntegrationsオプションにTeams connectorを追加することで使用します。
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',
}],
});
- Using the NPM package:
@squidcloud/teams-clientを使用している場合、以下のように実装できます:
// 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'
});