Home平台集成Google Chat

Google Chat 集成

将 ClawdBot 连接到 Google Chat

概述

Google Chat 是 Google Workspace 的团队通讯工具。 通过集成 ClawdBot,你可以在 Google Chat 的空间和私信中使用 AI 助手。

Google 生态

与 Workspace 深度集成

空间支持

在团队空间中协作

卡片消息

丰富的交互卡片

前提条件

  • Google Workspace 账户 - 企业或教育版
  • GCP 项目 - 用于创建 Chat App
  • 管理员权限 - 用于发布应用到组织

GCP 配置

步骤 1: 创建 GCP 项目

  1. 访问 Google Cloud Console
  2. 创建新项目或选择现有项目
  3. 记录项目 ID

步骤 2: 启用 API

# 使用 gcloud CLI
gcloud services enable chat.googleapis.com

或在控制台中搜索 "Google Chat API" 并启用。

步骤 3: 创建服务账号

  1. 进入 IAM & Admin → Service Accounts
  2. 创建服务账号
  3. 下载 JSON 密钥文件

Chat API 设置

配置 Chat App

  1. 在 GCP 控制台中找到 Google Chat API
  2. 点击 "Configuration"
  3. 填写应用信息:
    • App name: ClawdBot
    • Avatar URL: 你的头像地址
    • Description: AI 助手

设置连接方式

# HTTP Endpoint
App URL: https://your-server.com/api/googlechat

# 或使用 Pub/Sub
Topic: projects/your-project/topics/clawdbot

ClawdBot 配置

# ~/.clawdbot/config.yaml

channels:
  googlechat:
    enabled: true
    project_id: "your-gcp-project-id"
    credentials_file: "~/.clawdbot/google-credentials.json"

    # Webhook 模式
    mode: http
    endpoint: "/api/googlechat"

    # 或 Pub/Sub 模式
    # mode: pubsub
    # subscription: "projects/xxx/subscriptions/clawdbot"

环境变量

export GOOGLE_APPLICATION_CREDENTIALS="~/.clawdbot/google-credentials.json"
export CLAWDBOT_GOOGLECHAT_PROJECT="your-project-id"
clawdbot gateway

发布应用

内部发布

  1. 在 Chat API Configuration 中设置可见性
  2. 选择 "Make this Chat app available to specific people and groups"
  3. 添加测试用户

组织发布

  1. 选择 "Make available to everyone in your organization"
  2. Workspace 管理员需要批准

使用 Bot

在 Google Chat 中搜索 "ClawdBot" 即可开始使用。

故障排查

Bot 找不到

  • 确认 Chat API 已启用
  • 检查应用可见性设置
  • 等待几分钟让变更生效

消息无响应

  • 验证 Webhook URL 可访问
  • 检查服务账号权限
  • 查看 GCP 日志
# 诊断
clawdbot doctor --check googlechat
clawdbot logs --channel googlechat