Token导航 LogoToken导航

Agent Skill · 研究检索

google-chat-api(Google Chat API 搜索)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

google-chat-api 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 15,667。

总安装 7,684周安装 317GitHub Stars 750下载 2,511核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:google-chat-api(Google Chat API 搜索)
来源仓库:https://github.com/jezweb/claude-skills
仓库路径:skills/google-chat-api
安装命令:
npx skills add https://github.com/jezweb/claude-skills --skill google-chat-api
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jezweb/claude-skills --skill google-chat-api

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

使用 Cards v2、Spaces/Members/Reactions API 和不记名令牌验证构建 Google 聊天机器人、网络钩子和交互式表单。

支持两种集成模式:用于单向通知的传入 Webhook 和用于通过按钮单击和表单提交的交互式机器人的 HTTP 端点 Cards v2 具有 Markdown 和 HTML 格式、15 种以上小部件类型(文本、按钮、输入、日期选择器)以及每张卡 100 个小部件的限制 用于创建/列出/搜索空间的空间 API、用于管理成员资格和角色的成员 API 以及用于表情符号反应的反应 API 包括不记名令牌验证模板、表单验证模式、速率限制处理(3,000 次读取/分钟、60 次空间写入/分钟)以及六个常见问题的故障排除 Cloudflare Workers 推荐;令牌验证所需的 Web Crypto API;无官方 npm 包——直接使用 fetch API

来源仓库内路径:skills/google-chat-api

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/jezweb/claude-skills --skill google-chat-api;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

google-chat-api 怎么安装?

在终端执行 npx skills add https://github.com/jezweb/claude-skills --skill google-chat-api。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

google-chat-api 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

google-chat-api 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

google-chat-api 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

google-chat-api 用的人多吗?

公开数据是累计安装 7,684 次,近一周安装 317 次,下载 2,511 次,GitHub 750 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

google-chat-api 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
google-chat-api

Google Chat API 搜索 · 本页

7,684750接触敏感数据MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Google Chat API

Status: Production Ready Last Updated: 2026-01-09 (Added: Spaces API, Members API, Reactions API, Rate Limits) Dependencies: Cloudflare Workers (recommended), Web Crypto API for token verification Latest Versions: Google Chat API v1 (stable), Cards v2 (Cards v1 deprecated), wrangler@4.54.0


Quick Start (5 Minutes)

1. Create Webhook (Simplest Approach)

# No code needed - just configure in Google Chat
# 1. Go to Google Cloud Console
# 2. Create new project or select existing
# 3. Enable Google Chat API
# 4. Configure Chat app with webhook URL

Webhook URL: https://your-worker.workers.dev/webhook

Why this matters:

  • Simplest way to send messages to Chat
  • No authentication required for incoming webhooks
  • Perfect for notifications from external systems
  • Limited to sending messages (no interactive responses)

2. Create Interactive Bot (Cloudflare Worker)

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const event = await request.json()

    // Respond with a card
    return Response.json({
      text: "Hello from bot!",
      cardsV2: [{
        cardId: "unique-card-1",
        card: {
          header: { title: "Welcome" },
          sections: [{
            widgets: [{
              textParagraph: { text: "Click the button below" }
            }, {
              buttonList: {
                buttons: [{
                  text: "Click me",
                  onClick: {
                    action: {
                      function: "handleClick",
                      parameters: [{ key: "data", value: "test" }]
                    }
                  }
                }]
              }
            }]
          }]
        }
      }]
    })
  }
}

CRITICAL:

  • Must respond within timeout (typically 30 seconds)
  • Always return valid JSON with cardsV2 array
  • Card schema must be exact - one wrong field breaks the whole card

3. Verify Bearer Tokens (Production Security)

async function verifyToken(token: string): Promise<boolean> {
  // Verify token is signed by chat@system.gserviceaccount.com
  // See templates/bearer-token-verify.ts for full implementation
  return true
}

Why this matters:

  • Prevents unauthorized access to your bot
  • Required for HTTP endpoints (not webhooks)
  • Uses Web Crypto API (Cloudflare Workers compatible)

The 3-Step Setup Process

Step 1: Choose Integration Type

Option A: Incoming Webhook (Notifications Only)

Best for:

  • CI/CD notifications
  • Alert systems
  • One-way communication
  • External service → Chat

Setup:

  1. Create Chat space
  2. Configure incoming webhook in Space settings
  3. POST JSON to webhook URL

No code required - just HTTP POST:

curl -X POST 'https://chat.googleapis.com/v1/spaces/.../messages?key=...' \
  -H 'Content-Type: application/json' \
  -d '{"text": "Hello from webhook!"}'

Option B: HTTP Endpoint Bot (Interactive)

Best for:

  • Interactive forms
  • Button-based workflows
  • User input collection
  • Chat → Your service → Chat

Setup:

  1. Create Google Cloud project
  2. Enable Chat API
  3. Configure Chat app with HTTP endpoint
  4. Deploy Cloudflare Worker
  5. Handle events and respond with cards

Requires code - see templates/interactive-bot.ts

Step 2: Design Cards (If Using Interactive Bot)

IMPORTANT: Use Cards v2 only. Cards v1 was deprecated in 2025. Cards v2 matches Material Design on web (faster rendering, better aesthetics).

Cards v2 structure:

{
  "cardsV2": [{
    "cardId": "unique-id",
    "card": {
      "header": {
        "title": "Card Title",
        "subtitle": "Optional subtitle",
        "imageUrl": "https://..."
      },
      "sections": [{
        "header": "Section 1",
        "widgets": [
          { "textParagraph": { "text": "Some text" } },
          { "buttonList": { "buttons": [...] } }
        ]
      }]
    }
  }]
}

Widget Types:

  • textParagraph - Text content
  • buttonList - Buttons (text or icon)
  • textInput - Text input field
  • selectionInput - Dropdowns, checkboxes, switches
  • dateTimePicker - Date/time selection
  • divider - Horizontal line
  • image - Images
  • decoratedText - Text with icon/button

Text Formatting (NEW: Sept 2025 - GA):

Cards v2 supports both HTML and Markdown formatting:

// HTML formatting (traditional)
{
  textParagraph: {
    text: "This is <b>bold</b> and <i>italic</i> text with <font color='#ea9999'>color</font>"
  }
}

// Markdown formatting (NEW - better for AI agents)
{
  textParagraph: {
    text: "This is **bold** and *italic* text\n\n- Bullet list\n- Second item\n\n```\ncode block\n```"
  }
}

Supported Markdown (text messages and cards):

  • **bold** or *italic*
  • ` code ` for inline code
  • - list item or 1. ordered for lists
  • ``` `code block` ``` for multi-line code
  • ~strikethrough~

Supported HTML (cards only):

  • <b>bold</b>, <i>italic</i>, <u>underline</u>
  • <font color="#FF0000">colored</font>
  • <a href="url">link</a>

Why Markdown matters: LLMs naturally output Markdown. Before Sept 2025, you had to convert Markdown→HTML. Now you can pass Markdown directly to Chat.

CRITICAL:

  • Max 100 widgets per card - silently truncated if exceeded
  • Widget order matters - displayed top to bottom
  • cardId must be unique - use timestamp or UUID

Step 3: Handle User Interactions

When user clicks button or submits form:

export default {
  async fetch(request: Request): Promise<Response> {
    const event = await request.json()

    // Check event type
    if (event.type === 'MESSAGE') {
      // User sent message
      return handleMessage(event)
    }

    if (event.type === 'CARD_CLICKED') {
      // User clicked button
      const action = event.action.actionMethodName
      const params = event.action.parameters

      if (action === 'submitForm') {
        return handleFormSubmission(event)
      }
    }

    return Response.json({ text: "Unknown event" })
  }
}

Event Types:

  • ADDED_TO_SPACE - Bot added to space
  • REMOVED_FROM_SPACE - Bot removed
  • MESSAGE - User sent message
  • CARD_CLICKED - User clicked button/submitted form

Critical Rules

Always Do

✅ Return valid JSON with cardsV2 array structure ✅ Set unique cardId for each card ✅ Verify bearer tokens for HTTP endpoints (production) ✅ Handle all event types (MESSAGE, CARD_CLICKED, etc.) ✅ Keep widget count under 100 per card ✅ Validate form inputs server-side

Never Do

❌ Store secrets in code (use Cloudflare Workers secrets) ❌ Exceed 100 widgets per card (silently fails) ❌ Return malformed JSON (breaks entire message) ❌ Skip bearer token verification (security risk) ❌ Trust client-side validation only (validate server-side) ❌ Use synchronous blocking operations (timeout risk)


Known Issues Prevention

This skill prevents 6 documented issues:

Issue #1: Bearer Token Verification Fails (401)

Error: "Unauthorized" or "Invalid credentials" Source: Google Chat API Documentation Why It Happens: Token not verified or wrong verification method Prevention: Template includes Web Crypto API verification (Cloudflare Workers compatible)

Issue #2: Invalid Card JSON Schema (400)

Error: "Invalid JSON payload" or "Unknown field" Source: Cards v2 API Reference Why It Happens: Typo in field name, wrong nesting, or extra fields Prevention: Use google-chat-cards library or templates with exact schema

Issue #3: Widget Limit Exceeded (Silent Failure)

Error: No error - widgets beyond 100 simply don't render Source: Google Chat API Limits Why It Happens: Adding too many widgets to single card Prevention: Skill documents 100 widget limit + pagination patterns

Issue #4: Form Validation Error Format Wrong

Error: Form doesn't show validation errors to user Source: Interactive Cards Documentation Why It Happens: Wrong error response format Prevention: Templates include correct error format:

{
  "actionResponse": {
    "type": "DIALOG",
    "dialogAction": {
      "actionStatus": {
        "statusCode": "INVALID_ARGUMENT",
        "userFacingMessage": "Email is required"
      }
    }
  }
}

Issue #5: Webhook "Unable to Connect" Error

Error: Chat shows "Unable to connect to bot" Source: Webhook Setup Guide Why It Happens: URL not publicly accessible, timeout, or wrong response format Prevention: Skill includes timeout handling + response format validation

Issue #6: Rate Limit Exceeded (429)

Error: "RESOURCE_EXHAUSTED" or 429 status code Source: Google Chat API Quotas Why It Happens: Exceeding per-project, per-space, or per-user request limits Prevention: Skill documents rate limits + exponential backoff pattern


Configuration Files Reference

Cloudflare Worker (wrangler.jsonc)

{
  "name": "google-chat-bot",
  "main": "src/index.ts",
  "compatibility_date": "2026-01-03",
  "compatibility_flags": ["nodejs_compat"],

  // Secrets (set with: wrangler secret put CHAT_BOT_TOKEN)
  "vars": {
    "ALLOWED_SPACES": "spaces/SPACE_ID_1,spaces/SPACE_ID_2"
  }
}

Why these settings:

  • nodejs_compat - Required for Web Crypto API (token verification)
  • Secrets stored securely (not in code)
  • Environment variables for configuration

Common Patterns

Pattern 1: Notification Bot (Webhook)

// External service sends notification to Chat
async function sendNotification(webhookUrl: string, message: string) {
  await fetch(webhookUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      text: message,
      cardsV2: [{
        cardId: `notif-${Date.now()}`,
        card: {
          header: { title: "Alert" },
          sections: [{
            widgets: [{
              textParagraph: { text: message }
            }]
          }]
        }
      }]
    })
  })
}

When to use: CI/CD alerts, monitoring notifications, event triggers

Pattern 2: Interactive Form

// Show form to collect data
function showForm() {
  return {
    cardsV2: [{
      cardId: "form-card",
      card: {
        header: { title: "Enter Details" },
        sections: [{
          widgets: [
            {
              textInput: {
                name: "email",
                label: "Email",
                type: "SINGLE_LINE",
                hintText: "user@example.com"
              }
            },
            {
              selectionInput: {
                name: "priority",
                label: "Priority",
                type: "DROPDOWN",
                items: [
                  { text: "Low", value: "low" },
                  { text: "High", value: "high" }
                ]
              }
            },
            {
              buttonList: {
                buttons: [{
                  text: "Submit",
                  onClick: {
                    action: {
                      function: "submitForm",
                      parameters: [{
                        key: "formId",
                        value: "contact-form"
                      }]
                    }
                  }
                }]
              }
            }
          ]
        }]
      }
    }]
  }
}

When to use: Data collection, approval workflows, ticket creation

Pattern 3: Dialog (Modal)

// Open modal dialog
function openDialog() {
  return {
    actionResponse: {
      type: "DIALOG",
      dialogAction: {
        dialog: {
          body: {
            sections: [{
              header: "Confirm Action",
              widgets: [{
                textParagraph: { text: "Are you sure?" }
              }, {
                buttonList: {
                  buttons: [
                    {
                      text: "Confirm",
                      onClick: {
                        action: { function: "confirm" }
                      }
                    },
                    {
                      text: "Cancel",
                      onClick: {
                        action: { function: "cancel" }
                      }
                    }
                  ]
                }
              }]
            }]
          }
        }
      }
    }
  }
}

When to use: Confirmations, multi-step workflows, focused data entry


Using Bundled Resources

Scripts (scripts/)

No executable scripts for this skill.

Templates (templates/)

Required for all projects:

  • templates/webhook-handler.ts - Basic webhook receiver
  • templates/wrangler.jsonc - Cloudflare Workers config

Optional based on needs:

  • templates/interactive-bot.ts - HTTP endpoint with event handling
  • templates/card-builder-examples.ts - Common card patterns
  • templates/form-validation.ts - Input validation with error responses
  • templates/bearer-token-verify.ts - Token verification utility

When to load these: Claude should reference templates when user asks to:

  • Set up Google Chat bot
  • Create interactive cards
  • Add form validation
  • Verify bearer tokens
  • Handle button clicks

References (references/)

  • references/google-chat-docs.md - Key documentation links
  • references/cards-v2-schema.md - Complete card structure reference
  • references/common-errors.md - Error troubleshooting guide

When Claude should load these: Troubleshooting errors, designing cards, understanding API


Advanced Topics

Slash Commands

Register slash commands for quick actions:

// User types: /create-ticket Bug in login
if (event.message?.slashCommand?.commandName === 'create-ticket') {
  const text = event.message.argumentText

  return Response.json({
    text: `Creating ticket: ${text}`,
    cardsV2: [/* ticket confirmation card */]
  })
}

Use cases: Quick actions, shortcuts, power user features

Thread Replies

Reply in existing thread:

return Response.json({
  text: "Reply in thread",
  thread: {
    name: event.message.thread.name  // Use existing thread
  }
})

Use cases: Conversations, follow-ups, grouped discussions


Spaces API

Programmatically manage Google Chat spaces (rooms). Requires Chat Admin or App permissions.

Available Methods

MethodDescriptionScope Required
spaces.createCreate new spacechat.spaces.create
spaces.deleteDelete a spacechat.delete
spaces.getGet space detailschat.spaces.readonly
spaces.listList spaces bot is inchat.spaces.readonly
spaces.patchUpdate space settingschat.spaces
spaces.searchSearch spaces by criteriachat.spaces.readonly
spaces.setupCreate space and add memberschat.spaces.create
spaces.findDirectMessageFind DM with specific userchat.spaces.readonly

Create a Space

async function createSpace(accessToken: string) {
  const response = await fetch('https://chat.googleapis.com/v1/spaces', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      spaceType: 'SPACE',          // or 'GROUP_CHAT', 'DIRECT_MESSAGE'
      displayName: 'Project Team',
      singleUserBotDm: false,
      spaceDetails: {
        description: 'Team collaboration space',
        guidelines: 'Be respectful and on-topic'
      }
    })
  })
  return response.json()
}

List Spaces (Bot's Accessible Spaces)

async function listSpaces(accessToken: string) {
  const response = await fetch(
    'https://chat.googleapis.com/v1/spaces?pageSize=100',
    {
      headers: { 'Authorization': `Bearer ${accessToken}` }
    }
  )
  const data = await response.json()
  // Returns: { spaces: [...], nextPageToken: '...' }
  return data.spaces
}

Search Spaces

async function searchSpaces(accessToken: string, query: string) {
  const params = new URLSearchParams({
    query: query,  // e.g., 'displayName:Project'
    pageSize: '50'
  })
  const response = await fetch(
    `https://chat.googleapis.com/v1/spaces:search?${params}`,
    {
      headers: { 'Authorization': `Bearer ${accessToken}` }
    }
  )
  return response.json()
}

Search Query Syntax:

  • displayName:Project - Name contains "Project"
  • spaceType:SPACE - Only spaces (not DMs)
  • createTime>2025-01-01 - Created after date
  • Combine with AND/OR operators

Members API

Manage space membership programmatically. Requires User or App authorization.

Available Methods

MethodDescriptionScope Required
spaces.members.createAdd member to spacechat.memberships
spaces.members.deleteRemove memberchat.memberships
spaces.members.getGet member detailschat.memberships.readonly
spaces.members.listList all memberschat.memberships.readonly
spaces.members.patchUpdate member rolechat.memberships

Add Member to Space

async function addMember(accessToken: string, spaceName: string, userEmail: string) {
  const response = await fetch(
    `https://chat.googleapis.com/v1/${spaceName}/members`,
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        member: {
          name: `users/${userEmail}`,
          type: 'HUMAN'  // or 'BOT'
        },
        role: 'ROLE_MEMBER'  // or 'ROLE_MANAGER'
      })
    }
  )
  return response.json()
}

List Space Members

async function listMembers(accessToken: string, spaceName: string) {
  const response = await fetch(
    `https://chat.googleapis.com/v1/${spaceName}/members?pageSize=100`,
    {
      headers: { 'Authorization': `Bearer ${accessToken}` }
    }
  )
  return response.json()
  // Returns: { memberships: [...], nextPageToken: '...' }
}

Update Member Role

async function updateMemberRole(
  accessToken: string,
  memberName: string,  // e.g., 'spaces/ABC/members/DEF'
  newRole: 'ROLE_MEMBER' | 'ROLE_MANAGER'
) {
  const response = await fetch(
    `https://chat.googleapis.com/v1/${memberName}?updateMask=role`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ role: newRole })
    }
  )
  return response.json()
}

Member Roles:

  • ROLE_MEMBER - Standard member (read/write messages)
  • ROLE_MANAGER - Can manage space settings and members

Reactions API

Add emoji reactions to messages. Added in 2025, supports custom workspace emojis.

Available Methods

MethodDescription
spaces.messages.reactions.createAdd reaction to message
spaces.messages.reactions.deleteRemove reaction
spaces.messages.reactions.listList reactions on message

Add Reaction

async function addReaction(
  accessToken: string,
  messageName: string,  // e.g., 'spaces/ABC/messages/XYZ'
  emoji: string
) {
  const response = await fetch(
    `https://chat.googleapis.com/v1/${messageName}/reactions`,
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        emoji: {
          unicode: emoji  // e.g., '👍' or custom emoji code
        }
      })
    }
  )
  return response.json()
}

List Reactions

async function listReactions(accessToken: string, messageName: string) {
  const response = await fetch(
    `https://chat.googleapis.com/v1/${messageName}/reactions?pageSize=100`,
    {
      headers: { 'Authorization': `Bearer ${accessToken}` }
    }
  )
  return response.json()
  // Returns: { reactions: [...], nextPageToken: '...' }
}

Custom Emoji: Workspace administrators can upload custom emoji. Use the emoji's customEmoji.uid instead of unicode.


Rate Limits

Google Chat API enforces strict quotas to prevent abuse. Understanding these limits is critical for production apps.

Per-Project Quotas (Per Minute)

OperationLimitNotes
Read operations3,000/minspaces.get, members.list, messages.list
Membership writes300/minmembers.create, members.delete
Space writes60/minspaces.create, spaces.patch
Message operations600/minmessages.create, reactions.create
Reactions600/minShared with message operations

Per-Space Quotas (Per Second)

OperationLimit
Read operations15/sec
Write operations1/sec

Per-User Quotas

User-authenticated requests are also throttled per user:

  • 60 requests/minute per user for most operations
  • 10 requests/minute for space creation

Handling Rate Limit Errors

async function withRetry<T>(
  fn: () => Promise<T>,
  maxRetries = 3
): Promise<T> {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn()
    } catch (error: any) {
      if (error.status === 429) {
        // Rate limited - wait with exponential backoff
        const waitMs = Math.pow(2, i) * 1000 + Math.random() * 1000
        await new Promise(r => setTimeout(r, waitMs))
        continue
      }
      throw error
    }
  }
  throw new Error('Max retries exceeded')
}

// Usage
const spaces = await withRetry(() => listSpaces(accessToken))

Best Practices:

  • Cache read operations where possible
  • Batch membership operations
  • Use pagination efficiently (request larger pages, fewer requests)
  • Implement exponential backoff for 429 errors
  • Monitor quota usage in Google Cloud Console

Dependencies

Required:

  • Cloudflare Workers account (free tier works)
  • Google Cloud Project with Chat API enabled
  • Public HTTPS endpoint (Workers provides this)

Optional:

  • google-chat-cards@1.0.3 - Type-safe card builder (unofficial)
  • Web Crypto API (built into Cloudflare Workers)

Official Documentation


Package Versions (Verified 2026-01-09)

{
  "dependencies": {
    "google-chat-cards": "^1.0.3"
  },
  "devDependencies": {
    "@cloudflare/workers-types": "^4.20260109.0",
    "wrangler": "^4.58.0"
  }
}

Note: No official Google Chat npm package - use fetch API directly.


Production Example

This skill is based on real-world implementations:

  • Community Examples: translatebot (Worker + Chat + Translate API)
  • Official Samples: Multiple working examples in Google's documentation

Token Savings: ~65-70% (8k → 2.5k tokens) Errors Prevented: 6/6 documented issues Validation: ✅ Webhook handlers, ✅ Card builders, ✅ Token verification, ✅ Form validation, ✅ Rate limit handling


Troubleshooting

Problem: "Unauthorized" (401) error

Solution: Implement bearer token verification (see templates/bearer-token-verify.ts)

Problem: Cards don't render / "Invalid JSON payload"

Solution: Validate card JSON against Cards v2 schema, ensure exact field names

Problem: Widgets beyond first 100 don't show

Solution: Split into multiple cards or use pagination

Problem: Form validation errors not showing to user

Solution: Return correct error format with actionResponse.dialogAction.actionStatus

Problem: "Unable to connect to bot"

Solution: Ensure URL is publicly accessible, responds within timeout, returns valid JSON


Complete Setup Checklist

Use this checklist to verify your setup:

  • Google Cloud project created
  • Chat API enabled in project
  • Chat app configured with webhook/HTTP endpoint URL
  • Cloudflare Worker deployed and accessible
  • Bearer token verification implemented (if using HTTP endpoint)
  • Card JSON validated against schema
  • Widget count under 100 per card
  • Form validation returns correct error format
  • Tested in Chat space successfully
  • Error handling for all event types

Questions? Issues?

  1. Check references/common-errors.md for troubleshooting
  2. Verify card JSON structure matches Cards v2 schema
  3. Check official docs: https://developers.google.com/workspace/chat
  4. Ensure bearer token verification is implemented for HTTP endpoints

平台分布

Claude Code

27.74%
按下载量换算697

Gemini CLI

22.3%
按下载量换算560

Antigravity

16.91%
按下载量换算425

Cursor

11.9%
按下载量换算299

OpenCode

6.57%
按下载量换算165

Codex

3.37%
按下载量换算85

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills