介绍
# Google Meet
通过托管 OAuth 身份验证访问 Google Meet API。创建和管理会议空间,列出会议记录,并检索参与者信息。
## 快速开始
```bash # Create a meeting space python <<'EOF' import urllib.request, os, json data = json.dumps({}).encode() req = urllib.request.Request('https://gateway.maton.ai/google-meet/v2/spaces', data=data, method='POST') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') req.add_header('Content-Type', 'application/json') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
## 基础 URL
``` https://gateway.maton.ai/google-meet/{native-api-path} ```
将 `{native-api-path}` 替换为实际的 Google Meet API 端点路径。网关将请求代理到 `meet.googleapis.com` 并自动注入您的 OAuth 令牌。
## 身份验证
所有请求都需要在 Authorization 标头中包含 Maton API 密钥:
``` Authorization: Bearer $MATON_API_KEY ```
**环境变量:** 将您的 API 密钥设置为 `MATON_API_KEY`:
```bash export MATON_API_KEY="YOUR_API_KEY" ```
### 获取 API 密钥
1. 在 [maton.ai](https://maton.ai) 登录或创建账户 2. 前往 [maton.ai/settings](https://maton.ai/settings) 3. 复制您的 API 密钥
## 连接管理
在 `https://ctrl.maton.ai` 管理您的 Google OAuth 连接。
### 列出连接
```bash python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://ctrl.maton.ai/connections?app=google-meet&status=ACTIVE') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
### 创建连接
```bash python <<'EOF' import urllib.request, os, json data = json.dumps({'app': 'google-meet'}).encode() req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') req.add_header('Content-Type', 'application/json') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
### 获取连接
```bash python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
**响应:** ```json { "connection": { "connection_id": "21fd90f9-5935-43cd-b6c8-bde9d915ca80", "status": "ACTIVE", "creation_time": "2025-12-08T07:20:53.488460Z", "last_updated_time": "2026-01-31T20:03:32.593153Z", "url": "https://connect.maton.ai/?session_token=...", "app": "google-meet", "metadata": {} } } ```
在浏览器中打开返回的 `url` 以完成 OAuth 授权。
### 删除连接
```bash python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
### 指定连接
如果您有多个 Google Meet 连接,请使用 `Maton-Connection` 标头指定要使用的连接:
```bash python <<'EOF' import urllib.request, os, json data = json.dumps({}).encode() req = urllib.request.Request('https://gateway.maton.ai/google-meet/v2/spaces', data=data, method='POST') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') req.add_header('Content-Type', 'application/json') req.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
如果省略,网关将使用默认(最早)的活动连接。
## API 参考
### Spaces
#### 创建空间
```bash POST /google-meet/v2/spaces Content-Type: application/json
{} ```
**响应:** ```json { "name": "spaces/abc123", "meetingUri": "https://meet.google.com/abc-defg-hij", "meetingCode": "abc-defg-hij", "config": { "accessType": "OPEN", "entryPointAccess": "ALL" } } ```
#### 获取空间
```bash GET /google-meet/v2/spaces/{spaceId} ```
#### 更新空间
```bash PATCH /google-meet/v2/spaces/{spaceId} Content-Type: application/json
{ "config": { "accessType": "TRUSTED" } } ```
#### 结束进行中的通话
```bash POST /google-meet/v2/spaces/{spaceId}:endActiveConference ```
### Conference Records
#### 列出会议记录
```bash GET /google-meet/v2/conferenceRecords ```
使用筛选器:
```bash GET /google-meet/v2/conferenceRecords?filter=space.name="spaces/abc123" ```
#### 获取会议记录
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId} ```
### Participants
#### 列出参与者
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/participants ```
#### 获取参与者
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/participants/{participantId} ```
### Participant Sessions
#### 列出参与者会话
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/participants/{participantId}/participantSessions ```
### Recordings
#### 列出录音
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/recordings ```
#### 获取录音
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/recordings/{recordingId} ```
### Transcripts
#### 列出转录文本
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/transcripts ```
#### 获取转录文本
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/transcripts/{transcriptId} ```
#### 列出转录条目
```bash GET /google-meet/v2/conferenceRecords/{conferenceRecordId}/transcripts/{transcriptId}/entries ```
## 代码示例
### JavaScript
```javascript // Create a meeting space const response = await fetch( 'https://gateway.maton.ai/google-meet/v2/spaces', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.MATON_API_KEY}` }, body: JSON.stringify({}) } );
const space = await response.json(); console.log(`Meeting URL: ${space.meetingUri}`); ```
### Python
```python import os import requests
headers = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}' }
# Create a meeting space response = requests.post( 'https://gateway.maton.ai/google-meet/v2/spaces', headers=headers, json={} ) space = response.json() print(f"Meeting URL: {space['meetingUri']}") ```
## 注意事项
- Spaces 是可以重复使用的持久会议空间 - 会议记录在会议开始时创建,用于跟踪会议历史 - 访问类型:`OPEN`(任何拥有链接的人)、`TRUSTED`(仅组织成员)、`RESTRICTED`(仅受邀人员) - 录音和转录文本需要启用了录音功能的 Google Workspace - 重要提示:使用 curl 命令时,如果 URL 包含括号,请使用 `curl -g` 以禁用 glob 解析 - 重要提示:当通过管道将 curl 输出传递给 `jq` 或其他命令时,在某些 shell 环境中,像 `$MATON_API_KEY` 这样的环境变量可能无法正确展开。当通过管道传输时,您可能会遇到“Invalid API key”错误。
## 错误处理
| 状态 | 含义 | |--------|---------| | 400 | 缺少 Google Meet 连接 | | 401 | 无效或缺少 Maton API 密钥 | | 429 | 请求频率受限(每账户每秒 10 次)| | 4xx/5xx | 来自 Google Meet API 的透传错误 |
### 故障排除:无效的 API 密钥
**当您收到“Invalid API key”错误时,在确定存在问题之前请务必遵循以下步骤:**
1. 检查是否设置了 `MATON_API_KEY` 环境变量:
```bash echo $MATON_API_KEY ```
2. 通过列出连接来验证 API 密钥是否有效:
```bash python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://ctrl.maton.ai/connections') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ```
### 故障排除:无效的应用名称
1. 确保您的 URL 路径以 `google-meet` 开头。例如:
- 正确:`https://gateway.maton.ai/google-meet/v2/spaces` - 错误:`https://gateway.maton.ai/meet/v2/spaces`
## 资源
- [Google Meet API 概览](https://developers.google.com/meet/api/reference/rest) - [Spaces](https://developers.google.com/meet/api/reference/rest/v2/spaces) - [Conference Records](https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords) - [Participants](https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.participants) - [Recordings](https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.recordings) - [Transcripts](https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.transcripts) - [Maton 社区](https://discord.com/invite/dBfFAcefs2) - [Maton 支持](mailto:[email protected])