Google ChatでOpenClawを使う(Chat API Webhook)

【最新版】Google ChatでOpenClawを使う方法(Chat APIでDM/スペースに接続)

Google Chat

Google Chat(Chat API)

ステータス:Google Chat API の Webhook(HTTP のみ)で、DM とスペースに対応しています。

クイックセットアップ(初心者向け)

  1. Google Cloud プロジェクトを作成し、Google Chat API を有効化します。
  2. サービスアカウント を作成します。
    • Create CredentialsService Account を押します。
    • 名前は任意です(例:openclaw-chat)。
    • 権限は空のまま(Continue)。
    • アクセス権限(principals with access)も空のまま(Done)。
  3. JSON Key を作成してダウンロードします。
    • サービスアカウント一覧から、いま作ったアカウントをクリックします。
    • Keys タブを開きます。
    • Add KeyCreate new key を押します。
    • JSON を選んで Create を押します。
  4. ダウンロードした JSON ファイルを Gateway ホスト上に保存します(例:~/.openclaw/googlechat-service-account.json)。
  5. Google Cloud Console Chat Configurationで Google Chat アプリを作成します。
    • Application info を入力します。
      • App name:(例:OpenClaw
      • Avatar URL:(例:https://openclaw.ai/logo.png
      • Description:(例:Personal AI Assistant
    • Interactive features を有効化します。
    • FunctionalityJoin spaces and group conversations をチェックします。
    • Connection settingsHTTP endpoint URL を選びます。
    • TriggersUse a common HTTP endpoint URL for all triggers を選び、Gateway の public URL に /googlechat を付けた URL を設定します。
      • ヒント:openclaw status で Gateway の public URL を確認できます。
    • VisibilityMake this Chat app available to specific people and groups in <Your Domain> をチェックします。
    • メールアドレス(例:user@example.com)を入力します。
    • 下部の Save をクリックします。
  6. アプリのステータスを有効化します。
    • 保存後、ページをリロードします。
    • App status セクションを探します(保存後は上部または下部に表示されることが多いです)。
    • ステータスを Live - available to users に変更します。
    • もう一度 Save をクリックします。
  7. OpenClaw にサービスアカウントファイルのパスと Webhook audience を設定します。
    • Env:GOOGLE_CHAT_SERVICE_ACCOUNT_FILE=/path/to/service-account.json
    • または config:channels.googlechat.serviceAccountFile: "/path/to/service-account.json"
  8. Webhook audience の type と value を設定します(Chat アプリ設定と一致させます)。
  9. Gateway を起動します。Google Chat は Webhook パスに POST します。

Google Chat へ追加

Gateway が動いていて、あなたのメールが visibility list に入っている前提です。

  1. Google Chat を開きます。
  2. Direct Messages の横の +(プラス)をクリックします。
  3. 検索バー(普段ユーザーを追加するときの欄)に、Google Cloud Console で設定した App name を入力します。
    • Note:このボットは private app のため、Marketplace の browse list には表示されません。名前で検索する必要があります。
  4. 検索結果からボットを選びます。
  5. Add または Chat をクリックして 1:1 を開始します。
  6. Hello を送ってアシスタントを起動します。

Public URL(Webhook-only)

Google Chat の Webhook には public HTTPS endpoint が必要です。セキュリティのため、インターネットに公開するのは /googlechat パスのみにしてください。 OpenClaw ダッシュボードや他の機密 endpoint はプライベートネットワークに残します。

Option A: Tailscale Funnel(推奨)

Tailscale Serve で private dashboard、Funnel で public webhook path を分けます。これにより / を private のままにしつつ、/googlechat のみを公開できます。

  1. Gateway の bind アドレスを確認します:
    ss -tlnp | grep 18789

    IP アドレス(例:127.0.0.10.0.0.0、または 100.x.x.x のような Tailscale IP)を控えます。

  2. ダッシュボードを tailnet のみに公開します(ポート 8443):
    # If bound to localhost (127.0.0.1 or 0.0.0.0):
    tailscale serve --bg --https 8443 http://127.0.0.1:18789
    
    # If bound to Tailscale IP only (e.g., 100.106.161.80):
    tailscale serve --bg --https 8443 http://100.106.161.80:18789
  3. Webhook パスのみを public に公開します:
    # If bound to localhost (127.0.0.1 or 0.0.0.0):
    tailscale funnel --bg --set-path /googlechat http://127.0.0.1:18789/googlechat
    
    # If bound to Tailscale IP only (e.g., 100.106.161.80):
    tailscale funnel --bg --set-path /googlechat http://100.106.161.80:18789/googlechat
  4. 求められた場合、出力にある authorization URL にアクセスして Funnel を許可します。
  5. 設定を確認します:
    tailscale serve status
    tailscale funnel status

public webhook URL:

https://<node-name>.<tailnet>.ts.net/googlechat

private dashboard(tailnet-only):

https://<node-name>.<tailnet>.ts.net:8443/

Google Chat アプリ設定には(:8443 なしの)public URL を使います。

注:この設定は再起動後も残ります。削除する場合は tailscale funnel resettailscale serve reset を実行します。

Option B: Reverse Proxy(Caddy)

Caddy などの reverse proxy を使う場合は、特定パスのみを proxy します:

your-domain.com {
    reverse_proxy /googlechat* localhost:18789
}

この設定では、your-domain.com/ は無視されるか 404 になり、your-domain.com/googlechat のみが OpenClaw にルーティングされます。

Option C: Cloudflare Tunnel

トンネルの ingress ルールで、Webhook パスだけをルーティングします:

  • Path/googlechathttp://localhost:18789/googlechat
  • Default Rule:HTTP 404(Not Found)

How it works

  1. Google Chat は gateway に Webhook POST を送ります。各リクエストには Authorization: Bearer <token> が含まれます。
    • OpenClaw は、ヘッダーがある場合、Webhook body 全体を読む/パースする前に bearer auth を検証します。
    • body に authorizationEventObject.systemIdToken を含む Google Workspace Add-on リクエストは、より厳格な pre-auth body budget でサポートされます。
  2. OpenClaw は設定された audienceType + audience に対してトークンを検証します。
    • audienceType: "app-url" → audience は HTTPS webhook URL
    • audienceType: "project-number" → audience は Cloud project number
  3. メッセージは space ごとにルーティングされます。
    • DM:session key agent:<agentId>:googlechat:direct:<spaceId>
    • Spaces:session key agent:<agentId>:googlechat:group:<spaceId>
  4. DM はデフォルトで pairing です。不明な送信者には pairing code が返り、次で承認します:
    openclaw pairing approve googlechat <code>
  5. グループスペースはデフォルトで @メンションが必要です。メンション検出にアプリの user name が必要な場合は botUser を使います。

Targets

配信や allowlist に使う識別子:

  • Direct messages:users/<userId>(推奨)
  • Raw email name@example.com は可変のため、channels.googlechat.dangerouslyAllowNameMatching: true の場合のみ direct allowlist matching に使われます。
  • Deprecated:users/<email> は user id として扱われ、email allowlist ではありません。
  • Spaces:spaces/<spaceId>

Config highlights

{
  channels: {
    googlechat: {
      enabled: true,
      serviceAccountFile: "/path/to/service-account.json",
      // or serviceAccountRef: { source: "file", provider: "filemain", id: "/channels/googlechat/serviceAccount" }
      audienceType: "app-url",
      audience: "https://gateway.example.com/googlechat",
      webhookPath: "/googlechat",
      botUser: "users/1234567890", // optional; helps mention detection
      dm: {
        policy: "pairing",
        allowFrom: ["users/1234567890"],
      },
      groupPolicy: &quot;allowlist&quot;,
      groups: {
        "spaces/AAAA": {
          allow: true,
          requireMention: true,
          users: ["users/1234567890"],
          systemPrompt: "Short answers only.",
        },
      },
      actions: { reactions: true },
      typingIndicator: "message",
      mediaMaxMb: 20,
    },
  },
}

Notes:

  • サービスアカウント認証情報は serviceAccount(JSON string)として inline でも渡せます。
  • serviceAccountRef(env/file SecretRef)にも対応します。channels.googlechat.accounts.<id>.serviceAccountRef のようにアカウント単位の refs も可。
  • webhookPath を設定しない場合、デフォルトは /googlechat です。
  • dangerouslyAllowNameMatching は、可変な email principal matching を再有効化します(break-glass compatibility mode)。
  • リアクションは actions.reactions が有効なら reactions ツールと channels action から利用できます。
  • typingIndicatornone / message(デフォルト)/ reaction(reaction は user OAuth が必要)をサポートします。
  • 添付ファイルは Chat API 経由でダウンロードされ、media pipeline に保存されます(サイズ上限は mediaMaxMb)。

Secrets reference details:Secrets Management

トラブルシューティング

405 Method Not Allowed

Google Cloud Logs Explorer で次のようなエラーが出る場合:

status code: 405, reason phrase: HTTP error response: HTTP/1.1 405 Method Not Allowed

Webhook handler が登録されていないことを示します。よくある原因:

  1. Channel not configured:config に channels.googlechat がありません。次で確認:
    openclaw config get channels.googlechat

    Config path not found が返る場合、設定を追加してください(Config highlights 参照)。

  2. Plugin not enabled:プラグイン状態を確認:
    openclaw plugins list | grep googlechat

    disabled と出る場合、config に plugins.entries.googlechat.enabled: true を追加します。

  3. Gateway not restarted:設定追加後に gateway を再起動:
    openclaw gateway restart

Channel が動作しているか確認:

openclaw channels status
# Should show: Google Chat default: enabled, configured, ...

その他の問題

  • openclaw channels status --probe で auth エラーや audience 設定不足を確認します。
  • メッセージが届かない場合は、Chat app の webhook URL と event subscriptions を確認します。
  • メンション必須で返信できない場合は、botUser をアプリの user resource name に設定し、requireMention を確認します。
  • テストメッセージ送信時に openclaw logs --follow を使い、リクエストが gateway に届いているか確認します。

Related docs:

参考

BizClaw 導入支援

OpenClaw の構築を
まるごと代行します

Mac mini のセットアップから Slack・iMessage 連携まで、届いた日から使える状態でお届けします。

サービスを見る

関連記事

Read article
AIエージェントのメモリスタックとは?2026年に重要度が上がる理由をやさしく解説

AIエージェントのメモリスタックとは?2026年に重要度が上がる理由をやさしく解説

Read article
OpenClaw vs Hermes vs Claude、創業者はどれを選ぶべき?2026年版の実務比較

OpenClaw vs Hermes vs Claude、創業者はどれを選ぶべき?2026年版の実務比較

Read article
X公式MCPサーバーとは?AIエージェント運用で何が変わるのかを実務目線で解説

X公式MCPサーバーとは?AIエージェント運用で何が変わるのかを実務目線で解説