返回顶部
g

google-forms谷歌表单

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.5
安全检测
已通过
4,355
下载量
免费
免费
5
收藏
概述
安装方式
版本历史

google-forms

Google Forms

通过托管OAuth认证访问Google Forms API。创建表单、添加问题并获取回复。

快速开始

bash

获取表单


python < import urllib.request, os, json
req = urllib.request.Request(https://gateway.maton.ai/google-forms/v1/forms/{formId})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

基础URL

https://gateway.maton.ai/google-forms/{native-api-path}

将{native-api-path}替换为实际的Google Forms API端点路径。网关将请求代理到forms.googleapis.com并自动注入您的OAuth令牌。

认证

所有请求都需要在Authorization头中包含Maton API密钥:

Authorization: Bearer $MATONAPIKEY

环境变量: 将您的API密钥设置为MATONAPIKEY:

bash
export MATONAPIKEY=YOURAPIKEY

获取您的API密钥

  1. 1. 在maton.ai登录或创建账户
  2. 前往maton.ai/settings
  3. 复制您的API密钥

连接管理

在https://ctrl.maton.ai管理您的Google OAuth连接。

列出连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=google-forms&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

创建连接

bash
python < import urllib.request, os, json
data = json.dumps({app: google-forms}).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 < import urllib.request, os, json
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: 21fd90f9-5935-43cd-b6c8-bde9d915ca80,
status: ACTIVE,
creation_time: 2025-12-08T07:20:53.488460Z,
lastupdatedtime: 2026-01-31T20:03:32.593153Z,
url: https://connect.maton.ai/?session_token=...,
app: google-forms,
metadata: {}
}
}

在浏览器中打开返回的url以完成OAuth授权。

删除连接

bash
python < import urllib.request, os, json
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

指定连接

如果您有多个Google Forms连接,请使用Maton-Connection头指定要使用的连接:

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://gateway.maton.ai/google-forms/v1/forms/{formId})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

如果省略,网关将使用默认(最早创建的)活跃连接。

API参考

获取表单

bash
GET /google-forms/v1/forms/{formId}

创建表单

bash
POST /google-forms/v1/forms
Content-Type: application/json

{
info: {
title: 客户反馈调查
}
}

批量更新表单

bash
POST /google-forms/v1/forms/{formId}:batchUpdate
Content-Type: application/json

{
requests: [
{
createItem: {
item: {
title: 您叫什么名字?,
questionItem: {
question: {
required: true,
textQuestion: {paragraph: false}
}
}
},
location: {index: 0}
}
}
]
}

列出回复

bash
GET /google-forms/v1/forms/{formId}/responses

获取回复

bash
GET /google-forms/v1/forms/{formId}/responses/{responseId}

常用batchUpdate请求

创建文本问题

json
{
createItem: {
item: {
title: 问题文本,
questionItem: {
question: {
required: true,
textQuestion: {paragraph: false}
}
}
},
location: {index: 0}
}
}

创建选择题

json
{
createItem: {
item: {
title: 选择一个选项,
questionItem: {
question: {
choiceQuestion: {
type: RADIO,
options: [
{value: 选项A},
{value: 选项B}
]
}
}
}
},
location: {index: 0}
}
}

创建评分题

json
{
createItem: {
item: {
title: 评价您的体验,
questionItem: {
question: {
scaleQuestion: {
low: 1,
high: 5,
lowLabel: 差,
highLabel: 优秀
}
}
}
},
location: {index: 0}
}
}

问题类型

  • - textQuestion - 短文本或段落文本
  • choiceQuestion - 单选、多选或下拉菜单
  • scaleQuestion - 线性评分
  • dateQuestion - 日期选择器
  • timeQuestion - 时间选择器

代码示例

JavaScript

javascript
const response = await fetch(
https://gateway.maton.ai/google-forms/v1/forms/FORM_ID/responses,
{
headers: {
Authorization: Bearer ${process.env.MATONAPIKEY}
}
}
);

Python

python
import os
import requests

response = requests.get(
fhttps://gateway.maton.ai/google-forms/v1/forms/FORM_ID/responses,
headers={Authorization: fBearer {os.environ[MATONAPIKEY]}}
)

注意事项

  • - 表单ID可在表单URL中找到
  • 使用updateMask指定要更新的字段
  • 位置索引从0开始
  • 重要提示:使用curl命令时,当URL包含括号时请使用curl -g以禁用通配符解析
  • 重要提示:将curl输出通过管道传递给jq或其他命令时,某些shell环境中环境变量(如$MATONAPIKEY)可能无法正确展开。管道操作时可能会收到Invalid API key错误。

错误处理

状态码含义
400缺少Google Forms连接
401
无效或缺失Maton API密钥 | | 429 | 请求频率限制(每个账户10次/秒) | | 4xx/5xx | 来自Google Forms API的透传错误 |

故障排除:API密钥问题

  1. 1. 检查MATONAPIKEY环境变量是否已设置:

bash
echo $MATONAPIKEY

  1. 2. 通过列出连接验证API密钥是否有效:

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 google-forms-1775945987 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 google-forms-1775945987 技能

通过命令行安装

skillhub install google-forms-1775945987

下载

⬇ 下载 google-forms v1.0.5(免费)

文件大小: 3.92 KB | 发布时间: 2026-4-12 10:08

v1.0.5 最新 2026-4-12 10:08
- Added a "clawdbot" metadata section with an emoji and required environment variable information to the skill manifest.
- No other content or functional changes made in this version.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部