|
通过Microsoft Graph使用托管OAuth认证访问Microsoft Teams API。管理团队、频道、消息、会议,并访问录制内容和转录文本。
bash
https://gateway.maton.ai/microsoft-teams/{native-api-path}
将{native-api-path}替换为实际的Microsoft Graph API端点路径。网关将请求代理到graph.microsoft.com并自动注入您的OAuth令牌。
所有请求都需要在Authorization头中包含Maton API密钥:
Authorization: Bearer $MATONAPIKEY
环境变量: 将您的API密钥设置为MATONAPIKEY:
bash
export MATONAPIKEY=YOURAPIKEY
在https://ctrl.maton.ai管理您的Microsoft Teams OAuth连接。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=microsoft-teams&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
data = json.dumps({app: microsoft-teams}).encode()
req = urllib.request.Request(https://ctrl.maton.ai/connections, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
json
{
connection: {
connection_id: fb0fdc4a-0b5a-40cf-8b92-3bdae848cde3,
status: ACTIVE,
creation_time: 2026-02-17T09:51:21.074601Z,
lastupdatedtime: 2026-02-17T09:51:34.323814Z,
url: https://connect.maton.ai/?session_token=...,
app: microsoft-teams,
metadata: {}
}
}
在浏览器中打开返回的url以完成OAuth授权。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id}, method=DELETE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果您有多个Microsoft Teams连接,请使用Maton-Connection头指定要使用的连接:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/microsoft-teams/v1.0/me/joinedTeams)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Maton-Connection, fb0fdc4a-0b5a-40cf-8b92-3bdae848cde3)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最早创建的)活动连接。
bash
GET /microsoft-teams/v1.0/me/joinedTeams
响应:
json
{
@odata.context: https://graph.microsoft.com/v1.0/$metadata#teams,
@odata.count: 1,
value: [
{
id: b643f103-870d-4f98-a23d-e6f164fae33e,
displayName: carvedai.com,
description: null,
isArchived: false,
tenantId: cb83c3f9-6d16-4cf3-bd8c-ab16b37932f9
}
]
}
bash
GET /microsoft-teams/v1.0/teams/{team-id}
bash
GET /microsoft-teams/v1.0/teams/{team-id}/channels
响应:
json
{
@odata.context: https://graph.microsoft.com/v1.0/$metadata#teams(...)/channels,
@odata.count: 1,
value: [
{
id: 19:9fwtZjo3IM0D8bLdQqR-_oMFw1eUDlzWjPfIhNGhVd41@thread.tacv2,
createdDateTime: 2026-02-16T20:09:27.254Z,
displayName: General,
description: null,
email: carvedai.com473@carvedai.com,
membershipType: standard,
isArchived: false
}
]
}
bash
GET /microsoft-teams/v1.0/teams/{team-id}/channels?$filter=membershipType eq private
bash
GET /microsoft-teams/v1.0/teams/{team-id}/channels/{channel-id}
bash
POST /microsoft-teams/v1.0/teams/{team-id}/channels
Content-Type: application/json
{
displayName: New Channel,
description: Channel description,
membershipType: standard
}
响应:
json
{
id: 19:3b3361df822044558a062bb1a4ac8357@thread.tacv2,
createdDateTime: 2026-02-17T20:24:33.9284462Z,
displayName: Maton Test Channel,
description: Channel created by Maton integration test,
membershipType: standard,
isArchived: false
}
bash
PATCH /microsoft-teams/v1.0/teams/{team-id}/channels/{channel-id}
Content-Type: application/json
{
description: Updated description
}
成功时返回204 No Content。注意:默认的General频道无法更新。
bash
DELETE /microsoft-teams/v1.0/teams/{team-id}/channels/{channel-id}
成功时返回204 No Content。
bash
GET /microsoft-teams/v1.0/teams/{team-id}/channels/{channel-id}/members
响应:
json
{
@odata.count: 1,
value: [
{
@odata.type: #microsoft.graph.aadUserConversationMember,
id: MCMjMiMj...,
roles: [owner],
displayName: Kevin Kim,
userId: 5f56d55b-2ffb-448d-982a-b52547431f71,
email: richard@carvedai.com
}
]
}
bash
GET /microsoft-teams/v1.0/teams/{team-id}/channels/{channel-id}/messages
bash
POST /microsoft-teams/v1.0/teams/{team-id}/channels/{channel-id
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 microsoft-teams-1776209802 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 microsoft-teams-1776209802 技能
skillhub install microsoft-teams-1776209802
文件大小: 5.96 KB | 发布时间: 2026-4-15 10:23