托管 OAuth,极速接入 Google 日历
简介
通过 Maton 托管 OAuth 无缝接入 Google Calendar API,支持创建事件、查询日程、管理日历,CLI/Python/JS 多语言即用。
原始描述
Google Calendar API integration with managed OAuth. Create events, list calendars, check availability, and manage schedules. Use this skill when users want to interact with Google Calendar. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
通过你的 Agent 添加
安装目录:google-calendar/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
google-calendar 是 Maton 平台提供的 Google Calendar API 代理服务,采用托管式 OAuth 认证,用户无需自行申请 Google Cloud 项目或处理 OAuth 流程。通过统一的 api.maton.ai 网关,可直接调用原生 Calendar API 的全部能力,包括:
- 事件管理:创建、更新、删除、查询事件,支持自然语言快速创建(quickAdd)
- 日历操作:列出用户所有日历、查看日历详情、设置默认日历
- 可用性查询:Free/Busy 接口查询时间段占用状态
- 多连接管理:支持同一 Maton 账户绑定多个 Google 账号,通过
connection_id切换
调用方式覆盖 CLI (maton 命令)、原生 HTTP API(Python urllib/JavaScript fetch 等)以及程序化 SDK。所有请求通过 MATON_API_KEY 认证,OAuth token 由 Maton 自动注入,开发者只需关注业务逻辑。
显著优点
- 零配置 OAuth:省去 Google Cloud Console 项目创建、域名验证、OAuth 同意屏幕配置等繁琐步骤,分钟级接入。
- 原生 API 透传:完全兼容 Google Calendar API v3 路径和参数,现有 Google API 文档可直接复用。
- 多语言示例:提供 CLI、Python、JavaScript、curl 等完整代码片段,降低上手门槛。
- 连接生命周期管理:支持创建、查看、删除 Google OAuth 连接,并可通过
Maton-Connection 头部在多账号间切换。
- 企业级安全提示:文档明确标注“所有写入操作需显式用户确认”,符合最小权限原则。
潜在缺点与局限性
- 依赖第三方平台:服务可用性与 Maton 平台强绑定,若 Maton 服务中断或调整定价策略,将影响使用。
- 速率限制:文档提及 10 req/sec 每账号的限流,高并发场景需本地缓存或限流处理。
- 数据隐私顾虑:日历数据需经过 Maton 代理服务器,对敏感日程(如医疗、法律预约)存在合规风险。
- 功能边界:仅覆盖 Calendar API,如需 Gmail、Drive 等需额外技能或走
api-gateway 通用代理。
- 连接管理复杂度:多账号场景下需手动管理
connection_id,易因误操作导致数据写入错误账户。
适合人群
- 快速原型开发者:需在 30 分钟内实现日程集成,不愿投入 OAuth 配置时间。
- 自动化脚本用户:希望用 Python/Node 批量导入/导出日历数据,或定时同步外部系统。
- 多账号运营者:个人助理、客服团队等需同时管理多个 Google 日历账号。
- 企业内部工具搭建:构建会议预定机器人、团队日程看板等内部系统。
常规风险
风险类型
说明
缓解建议
密钥泄露
MATON_API_KEY 泄露将导致账户内所有 Google 日历数据暴露
使用环境变量注入,禁止硬编码;定期轮换密钥
误操作覆盖
自动化脚本批量更新/删除事件,可能覆盖重要日程
写入前二次确认;先查询再修改;保留备份
连接混淆
多账号时未指定 connection_id,操作落到默认账号
强制显式传入连接 ID;代码审查加入连接校验
服务中断
Maton 或 Google API 故障导致同步失败
关键业务加入重试与降级逻辑;本地持久化队列
合规风险
跨境数据传输、行业数据监管要求
评估 Maton 数据处理协议;敏感场景自建 OAuth
综合评价
Maton-Connection 头部在多账号间切换。- 依赖第三方平台:服务可用性与 Maton 平台强绑定,若 Maton 服务中断或调整定价策略,将影响使用。
- 速率限制:文档提及 10 req/sec 每账号的限流,高并发场景需本地缓存或限流处理。
- 数据隐私顾虑:日历数据需经过 Maton 代理服务器,对敏感日程(如医疗、法律预约)存在合规风险。
- 功能边界:仅覆盖 Calendar API,如需 Gmail、Drive 等需额外技能或走
api-gateway通用代理。 - 连接管理复杂度:多账号场景下需手动管理
connection_id,易因误操作导致数据写入错误账户。
适合人群
- 快速原型开发者:需在 30 分钟内实现日程集成,不愿投入 OAuth 配置时间。
- 自动化脚本用户:希望用 Python/Node 批量导入/导出日历数据,或定时同步外部系统。
- 多账号运营者:个人助理、客服团队等需同时管理多个 Google 日历账号。
- 企业内部工具搭建:构建会议预定机器人、团队日程看板等内部系统。
常规风险
风险类型
说明
缓解建议
密钥泄露
MATON_API_KEY 泄露将导致账户内所有 Google 日历数据暴露
使用环境变量注入,禁止硬编码;定期轮换密钥
误操作覆盖
自动化脚本批量更新/删除事件,可能覆盖重要日程
写入前二次确认;先查询再修改;保留备份
连接混淆
多账号时未指定 connection_id,操作落到默认账号
强制显式传入连接 ID;代码审查加入连接校验
服务中断
Maton 或 Google API 故障导致同步失败
关键业务加入重试与降级逻辑;本地持久化队列
合规风险
跨境数据传输、行业数据监管要求
评估 Maton 数据处理协议;敏感场景自建 OAuth
综合评价
| 风险类型 | 说明 | 缓解建议 |
|---|---|---|
| 密钥泄露 | MATON_API_KEY 泄露将导致账户内所有 Google 日历数据暴露 |
使用环境变量注入,禁止硬编码;定期轮换密钥 |
| 误操作覆盖 | 自动化脚本批量更新/删除事件,可能覆盖重要日程 | 写入前二次确认;先查询再修改;保留备份 |
| 连接混淆 | 多账号时未指定 connection_id,操作落到默认账号 |
强制显式传入连接 ID;代码审查加入连接校验 |
| 服务中断 | Maton 或 Google API 故障导致同步失败 | 关键业务加入重试与降级逻辑;本地持久化队列 |
| 合规风险 | 跨境数据传输、行业数据监管要求 | 评估 Maton 数据处理协议;敏感场景自建 OAuth |
综合评价
google-calendar 技能是 Maton 生态中典型的“托管 API 代理”模式代表,以牺牲部分自主性换取极致开发效率。对于非敏感场景、追求快速迭代的团队极具价值;若处于强监管行业或对数据主权有严格要求,建议评估自托管方案或直接使用 Google 官方 OAuth 流程。
技能正文
name: google-calendar
description: |
Google Calendar API integration with managed OAuth. Create events, list calendars, check availability, and manage schedules. Use this skill when users want to interact with Google Calendar. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
compatibility: Requires network access and valid Maton API key
metadata:
author: maton
version: "1.0"
clawdbot:
emoji: 🧠
requires:
env:
- MATON_API_KEY
Google Calendar
Access the Google Calendar API with managed OAuth authentication. Create and manage events, list calendars, and check availability.
Quick Start
Show today's events on the primary calendar.
CLI:
# Show today's agenda (defaults to primary calendar when -c is omitted)
maton google-calendar agenda --today
maton api '/google-calendar/calendar/v3/calendars/primary/events?singleEvents=true&orderBy=startTime&timeMin=2026-05-05T00:00:00Z&timeMax=2026-05-06T00:00:00Z'
Python:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events?singleEvents=true&orderBy=startTime&timeMin=2026-05-05T00:00:00Z&timeMax=2026-05-06T00:00:00Z')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Base URL
https://api.maton.ai/google-calendar/{native-api-path}
https://api.maton.ai/google-calendar/{native-api-path}
Maton proxies requests to www.googleapis.com and automatically injects your OAuth token.
Installation
NPM:
npm install -g @maton/cli
Homebrew:
brew install maton-ai/cli/maton
Authentication
CLI:
maton login # Opens browser for API key
maton login --interactive # Skip browser, paste API key directly
maton whoami # Show current auth state
Manual:
- Sign in or create an account at maton.ai
- Go to maton.ai/settings
- Copy your API key
- Set your API key as
MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Connection Management
Manage your Google OAuth connections at https://api.maton.ai.
List Connections
CLI:
maton connection list google-calendar --status ACTIVE
maton api -X GET /connections -f app=google-calendar -f status=ACTIVE
Python:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections?app=google-calendar&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
Create Connection
CLI:
maton connection create google-calendar
maton api /connections -f app=google-calendar
Python:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'google-calendar'}).encode()
req = urllib.request.Request('https://api.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
Get Connection
CLI:
maton connection view {connection_id}
maton api /connections/{connection_id}
Python:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.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
Response:
{
"connection": {
"connection_id": "{connection_id}",
"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-calendar",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
Delete Connection
CLI:
maton connection delete {connection_id}
maton api -X DELETE /connections/{connection_id}
Python:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.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
Specifying Connection
If you have multiple Google Calendar connections, specify which one to use:
CLI:
maton google-calendar event list -c primary --connection {connection_id}
maton api /google-calendar/calendar/v3/calendars/primary/events --connection {connection_id}
Python:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '{connection_id}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If you have multiple connections, always specify the connection to ensure requests go to the intended account.
Security & Permissions
- Access is scoped to calendars, events, and availability within the connected Google Calendar account.
- All write operations require explicit user approval. Before executing any create, update, or delete call, confirm the target resource and intended effect with the user.
API Reference
List Calendars
GET /google-calendar/calendar/v3/users/me/calendarList
List Calendars
GET /google-calendar/calendar/v3/users/me/calendarList
Example:
maton google-calendar calendar list
Get Calendar
GET /google-calendar/calendar/v3/calendars/{calendarId}
GET /google-calendar/calendar/v3/calendars/{calendarId}
Example:
maton google-calendar calendar view primary
List Events
GET /google-calendar/calendar/v3/calendars/team@example.com/events?maxResults=10&orderBy=startTime&singleEvents=true
GET /google-calendar/calendar/v3/calendars/team@example.com/events?maxResults=10&orderBy=startTime&singleEvents=true
With time bounds:
GET /google-calendar/calendar/v3/calendars/team@example.com/events?timeMin=2024-01-01T00:00:00Z&timeMax=2024-12-31T23:59:59Z&singleEvents=true&orderBy=startTime
Example:
maton google-calendar event list -c team@example.com --time-min 2026-06-17T00:00:00Z --time-max 2026-06-18T00:00:00Z
Get Event
GET /google-calendar/calendar/v3/calendars/primary/events/{eventId}
GET /google-calendar/calendar/v3/calendars/primary/events/{eventId}
Example:
maton google-calendar event view EVENT_ID
Create Event
POST /google-calendar/calendar/v3/calendars/primary/events
Content-Type: application/json
{
"summary": "Team Meeting",
"description": "Weekly sync",
"start": {
"dateTime": "2024-01-15T10:00:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2024-01-15T11:00:00",
"timeZone": "America/Los_Angeles"
},
"attendees": [
{"email": "attendee@example.com"}
]
}
POST /google-calendar/calendar/v3/calendars/primary/events
Content-Type: application/json
{
"summary": "Team Meeting",
"description": "Weekly sync",
"start": {
"dateTime": "2024-01-15T10:00:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2024-01-15T11:00:00",
"timeZone": "America/Los_Angeles"
},
"attendees": [
{"email": "attendee@example.com"}
]
}
Example:
maton google-calendar event create --summary 'Team Meeting' --description 'Weekly sync' --start 2024-01-15T10:00:00-08:00 --end 2024-01-15T11:00:00-08:00 --attendee attendee@example.com
Create All-Day Event
POST /google-calendar/calendar/v3/calendars/primary/events
Content-Type: application/json
{
"summary": "All Day Event",
"start": {"date": "2024-01-15"},
"end": {"date": "2024-01-16"}
}
Update Event
PUT /google-calendar/calendar/v3/calendars/primary/events/{eventId}
Content-Type: application/json
{
"summary": "Updated Meeting Title",
"start": {"dateTime": "2024-01-15T10:00:00Z"},
"end": {"dateTime": "2024-01-15T11:00:00Z"}
}
POST /google-calendar/calendar/v3/calendars/primary/events
Content-Type: application/json
{
"summary": "All Day Event",
"start": {"date": "2024-01-15"},
"end": {"date": "2024-01-16"}
}
PUT /google-calendar/calendar/v3/calendars/primary/events/{eventId}
Content-Type: application/json
{
"summary": "Updated Meeting Title",
"start": {"dateTime": "2024-01-15T10:00:00Z"},
"end": {"dateTime": "2024-01-15T11:00:00Z"}
}
Example:
maton google-calendar event update EVENT_ID --summary 'Updated Meeting Title' --start 2024-01-15T10:00:00Z --end 2024-01-15T11:00:00Z
Patch Event (partial update)
PATCH /google-calendar/calendar/v3/calendars/primary/events/{eventId}
Content-Type: application/json
{
"summary": "New Title Only"
}
PATCH /google-calendar/calendar/v3/calendars/primary/events/{eventId}
Content-Type: application/json
{
"summary": "New Title Only"
}
Example:
maton google-calendar event update EVENT_ID --summary 'New Title Only'
Delete Event
DELETE /google-calendar/calendar/v3/calendars/primary/events/{eventId}
DELETE /google-calendar/calendar/v3/calendars/primary/events/{eventId}
Example:
maton google-calendar event delete EVENT_ID
Quick Add Event (natural language)
POST /google-calendar/calendar/v3/calendars/primary/events/quickAdd?text=Meeting+with+John+tomorrow+at+3pm
POST /google-calendar/calendar/v3/calendars/primary/events/quickAdd?text=Meeting+with+John+tomorrow+at+3pm
Example:
maton google-calendar event quick-add --text 'Meeting with John tomorrow at 3pm'
Free/Busy Query
POST /google-calendar/calendar/v3/freeBusy
Content-Type: application/json
{
"timeMin": "2024-01-15T00:00:00Z",
"timeMax": "2024-01-16T00:00:00Z",
"items": [{"id": "primary"}]
}
POST /google-calendar/calendar/v3/freeBusy
Content-Type: application/json
{
"timeMin": "2024-01-15T00:00:00Z",
"timeMax": "2024-01-16T00:00:00Z",
"items": [{"id": "primary"}]
}
Example:
maton google-calendar freebusy query --time-min 2024-01-15T00:00:00Z --time-max 2024-01-16T00:00:00Z
Pagination
Google Calendar uses token-based pagination. The CLI automatically paginates with '--paginate'.
Example:
maton google-calendar event list --paginate
Code Examples
CLI
# Show today's agenda (defaults to primary calendar when -c is omitted)
maton google-calendar agenda --today
# Filter with jq
maton google-calendar event list --json --jq '.items[] | {summary: .summary, start: .start.dateTime}'
# Extract specific fields
maton google-calendar calendar list --json --jq '.items[].summary'
JavaScript
// List events
const response = await fetch(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events?maxResults=10&singleEvents=true',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
// Create event
await fetch(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
},
body: JSON.stringify({
summary: 'Meeting',
start: { dateTime: '2024-01-15T10:00:00Z' },
end: { dateTime: '2024-01-15T11:00:00Z' }
})
}
);
Python
import os
import requests
headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
# List events
events = requests.get(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events',
headers=headers,
params={'maxResults': 10, 'singleEvents': 'true'}
).json()
# Create event
response = requests.post(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events',
headers=headers,
json={
'summary': 'Meeting',
'start': {'dateTime': '2024-01-15T10:00:00Z'},
'end': {'dateTime': '2024-01-15T11:00:00Z'}
}
)
Notes
- Times must be in RFC3339 format (e.g.,
2024-01-15T10:00:00Z)
- For recurring events, use
singleEvents=true to expand instances
orderBy=startTime requires singleEvents=true
- IMPORTANT: When using curl commands, use
curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.
Error Handling
Status
Meaning
400
Missing Google Calendar connection
401
Invalid or missing Maton API key
429
Rate limited (10 req/sec per account)
4xx/5xx
Passthrough error from Google Calendar API
Troubleshooting: API Key Issues
// List events
const response = await fetch(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events?maxResults=10&singleEvents=true',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
// Create event
await fetch(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
},
body: JSON.stringify({
summary: 'Meeting',
start: { dateTime: '2024-01-15T10:00:00Z' },
end: { dateTime: '2024-01-15T11:00:00Z' }
})
}
);
import os
import requests
headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
# List events
events = requests.get(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events',
headers=headers,
params={'maxResults': 10, 'singleEvents': 'true'}
).json()
# Create event
response = requests.post(
'https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events',
headers=headers,
json={
'summary': 'Meeting',
'start': {'dateTime': '2024-01-15T10:00:00Z'},
'end': {'dateTime': '2024-01-15T11:00:00Z'}
}
)
Notes
- Times must be in RFC3339 format (e.g.,
2024-01-15T10:00:00Z)
- For recurring events, use
singleEvents=true to expand instances
orderBy=startTime requires singleEvents=true
- IMPORTANT: When using curl commands, use
curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.
Error Handling
Status
Meaning
400
Missing Google Calendar connection
401
Invalid or missing Maton API key
429
Rate limited (10 req/sec per account)
4xx/5xx
Passthrough error from Google Calendar API
Troubleshooting: API Key Issues
2024-01-15T10:00:00Z)singleEvents=true to expand instancesorderBy=startTime requires singleEvents=truecurl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsingjq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.| Status | Meaning |
|---|---|
| 400 | Missing Google Calendar connection |
| 401 | Invalid or missing Maton API key |
| 429 | Rate limited (10 req/sec per account) |
| 4xx/5xx | Passthrough error from Google Calendar API |
Troubleshooting: API Key Issues
CLI:
- Check your auth state:
maton whoami
- Verify the API key is valid by listing connections:
maton connection list
Manual:
- Check that the
MATON_API_KEYenvironment variable is set:
echo $MATON_API_KEY
- Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.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
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
google-calendar. For example:
- Correct:
https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/events
- Incorrect:
https://api.maton.ai/calendar/v3/calendars/primary/events
Resources
google-calendar. For example:https://api.maton.ai/google-calendar/calendar/v3/calendars/primary/eventshttps://api.maton.ai/calendar/v3/calendars/primary/events正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。