微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📋

托管 OAuth 极速接入 Google 表单

Google Forms · v1.0.5
developer-tools 安全 A 级 作者 byungkyu 公开目录收录
4.5k 下载 5 安装 17.7k 收藏 15 浏览

简介

通过 Maton 托管 OAuth 接入 Google Forms API,无需自行维护令牌即可创建表单、管理问题与获取响应数据,适合快速构建调研与数据收集流程。

原始描述

Google Forms API integration with managed OAuth. Create forms, add questions, and retrieve responses. Use this skill when users want to interact with Google Forms. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).

通过你的 Agent 添加

安装目录:google-forms/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/google-forms/
Codex CLI~/.codex/skills/google-forms/
DeepSeek Harness~/.agents/skills/google-forms/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

本 Skill 是 Google Forms API 的代理网关,采用托管 OAuth 2.0 模式(Maton 平台代为维护令牌刷新),用户仅需提供 MATON_API_KEY 即可调用完整 API。核心能力覆盖:

  • 表单生命周期管理:创建表单(POST /v1/forms)、批量更新(batchUpdate)、查询元数据(GET /v1/forms/{formId})。
  • 题型配置:支持文本题(含段落/短文本)、单选/多选/下拉(choiceQuestion)、线性量表(scaleQuestion)、日期与时间选择器等。
  • 响应数据获取:列出所有响应(GET /v1/forms/{formId}/responses)或获取单条响应详情。
  • 多连接管理:支持在 ctrl.maton.ai 后台创建、查看、删除 Google OAuth 连接,并通过 Maton-Connection 请求头在多账号间切换。

技术接入上,请求路径需以 google-forms 为前缀(如 https://gateway.maton.ai/google-forms/v1/forms/...),Maton 网关负责将请求代理至 forms.googleapis.com 并注入有效 OAuth Token。

显著优点

  1. 零 OAuth 维护成本:开发者无需处理 Google OAuth 2.0 的授权码交换、Token 刷新与存储,Maton 平台托管全生命周期。
  2. 原生 API 透传:直接映射 Google 官方 REST API,支持所有高级特性(如 updateMask 细粒度更新、batchUpdate 原子批量操作)。
  3. 多租户隔离:通过 Connection ID 区分不同 Google 账号,适合 SaaS 多客户场景或团队多账号管理。
  4. 多语言示例完备:文档提供 Bash/curl、Python、JavaScript 等即拷即用代码片段,降低接入门槛。
  5. 错误透明:HTTP 状态码与 Google 原生 API 保持一致(如 400 为连接缺失、401 为 API Key 无效、429 为限流),便于定位问题。

潜在缺点与局限性

  1. 平台锁定风险:OAuth 授权与 Token 完全托管于 Maton,若平台服务中断或策略变更,可能导致授权失效;迁移需重新走 Google OAuth 流程。
  2. 网络依赖与延迟:所有流量需经过 gateway.maton.ai 代理,相比直连 Google 增加一跳网络延迟,且受 Maton 网关稳定性制约。
  3. 速率限制不透明:文档仅提及「10 req/sec per account」的粗略限流,未说明 Google 侧剩余配额(如每日 10000 请求)是否独立计算或共享。
  4. 调试复杂度:OAuth 授权 URL 需人工在浏览器完成,自动化 CI/CD 场景难以无人值守;多连接场景下需手动指定 Maton-Connection 头,易遗漏。
  5. Shell 环境陷阱:文档特别提示 curl 与 jq 管道时环境变量可能不展开,需改用 Python/Node 等脚本方式规避,增加脚本编写成本。

适合人群

  • 快速原型开发者:需要在数小时内搭建问卷系统,不愿投入时间配置 Google Cloud 项目与 OAuth 凭据。
  • 多账号运营团队:如市场部门管理多个品牌 Google 账号,需在同一系统内切换表单操作。
  • 低代码/自动化工作流:配合 n8n、Make 或自研脚本,将表单创建与数据收集纳入自动化管道。

常规风险

风险类别 说明
数据隐私合规 表单响应数据流经 Maton 网关,虽为透传代理,但需确认 Maton 隐私政策是否满足 GDPR、CCPA 等合规要求。
API Key 泄露 MATON_API_KEY 作为唯一凭证,若硬编码于前端或日志中,可能导致账号被滥用;建议仅存储于服务端环境变量。
OAuth 权限粒度 授权时 Google 可能请求较宽范围权限(如访问全部表单),用户需确认是否接受,无法细粒度限定至单表单。
服务连续性 依赖 Maton 平台持续运营,建议定期备份关键表单 ID 与响应数据,防范供应商锁定。

技能正文


name: google-forms description: | Google Forms API integration with managed OAuth. Create forms, add questions, and retrieve responses. Use this skill when users want to interact with Google Forms. 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 Forms

Access the Google Forms API with managed OAuth authentication. Create forms, add questions, and retrieve responses.

Quick Start

# Get form
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/google-forms/v1/forms/{formId}')
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://gateway.maton.ai/google-forms/{native-api-path}

Replace {native-api-path} with the actual Google Forms API endpoint path. The gateway proxies requests to forms.googleapis.com and automatically injects your OAuth token.

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Google OAuth connections at https://ctrl.maton.ai.

List Connections

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=google-forms&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

python <<'EOF'
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.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

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

Response:

{
  "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-forms",
    "metadata": {}
  }
}

Open the returned url in a browser to complete OAuth authorization.

Delete Connection

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

Specifying Connection

If you have multiple Google Forms connections, specify which one to use with the Maton-Connection header:

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

If omitted, the gateway uses the default (oldest) active connection.

API Reference

Get Form

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

Create Form

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

{
  "info": {
    "title": "Customer Feedback Survey"
  }
}

Batch Update Form

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

{
  "requests": [
    {
      "createItem": {
        "item": {
          "title": "What is your name?",
          "questionItem": {
            "question": {
              "required": true,
              "textQuestion": {"paragraph": false}
            }
          }
        },
        "location": {"index": 0}
      }
    }
  ]
}

List Responses

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

Get Response

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

Common batchUpdate Requests

Create Text Question

{
  "createItem": {
    "item": {
      "title": "Question text",
      "questionItem": {
        "question": {
          "required": true,
          "textQuestion": {"paragraph": false}
        }
      }
    },
    "location": {"index": 0}
  }
}

Create Multiple Choice

{
  "createItem": {
    "item": {
      "title": "Select an option",
      "questionItem": {
        "question": {
          "choiceQuestion": {
            "type": "RADIO",
            "options": [
              {"value": "Option A"},
              {"value": "Option B"}
            ]
          }
        }
      }
    },
    "location": {"index": 0}
  }
}

Create Scale Question

{
  "createItem": {
    "item": {
      "title": "Rate your experience",
      "questionItem": {
        "question": {
          "scaleQuestion": {
            "low": 1,
            "high": 5,
            "lowLabel": "Poor",
            "highLabel": "Excellent"
          }
        }
      }
    },
    "location": {"index": 0}
  }
}

Question Types

  • textQuestion - Short or paragraph text
  • choiceQuestion - Radio, checkbox, or dropdown
  • scaleQuestion - Linear scale
  • dateQuestion - Date picker
  • timeQuestion - Time picker

Code Examples

JavaScript

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

Python

import os
import requests

response = requests.get(
    f'https://gateway.maton.ai/google-forms/v1/forms/FORM_ID/responses',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)

Notes

  • Form IDs are found in the form URL
  • Use updateMask to specify fields to update
  • Location index is 0-based
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets 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 Forms connection
401 Invalid or missing Maton API key
429 Rate limited (10 req/sec per account)
4xx/5xx Passthrough error from Google Forms API

Troubleshooting: API Key Issues

  1. Check that the MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
  1. Verify the API key is valid by listing connections:
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

Troubleshooting: Invalid App Name

  1. Ensure your URL path starts with google-forms. For example:
  • Correct: https://gateway.maton.ai/google-forms/v1/forms/{formId}
  • Incorrect: https://gateway.maton.ai/forms/v1/forms/{formId}

Resources

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

google-workspaceapi-gatewayoauthformssurveydata-collectionautomationrest-api

同类 Skill