
【最新版】Google ChatでOpenClawを使う方法(Chat APIでDM/スペースに接続)
2026年3月18日
Google Chat
Google Chat(Chat API)
ステータス:Google Chat API の Webhook(HTTP のみ)で、DM とスペースに対応しています。
クイックセットアップ(初心者向け)
- Google Cloud プロジェクトを作成し、Google Chat API を有効化します。
- こちら:Google Chat API Credentials
- まだ有効になっていなければ API を有効化します。
- サービスアカウント を作成します。
- Create Credentials → Service Account を押します。
- 名前は任意です(例:
openclaw-chat)。 - 権限は空のまま(Continue)。
- アクセス権限(principals with access)も空のまま(Done)。
- JSON Key を作成してダウンロードします。
- サービスアカウント一覧から、いま作ったアカウントをクリックします。
- Keys タブを開きます。
- Add Key → Create new key を押します。
- JSON を選んで Create を押します。
- ダウンロードした JSON ファイルを Gateway ホスト上に保存します(例:
~/.openclaw/googlechat-service-account.json)。 - Google Cloud Console Chat Configurationで Google Chat アプリを作成します。
- Application info を入力します。
- App name:(例:
OpenClaw) - Avatar URL:(例:
https://openclaw.ai/logo.png) - Description:(例:
Personal AI Assistant)
- App name:(例:
- Interactive features を有効化します。
- Functionality で Join spaces and group conversations をチェックします。
- Connection settings で HTTP endpoint URL を選びます。
- Triggers で Use a common HTTP endpoint URL for all triggers を選び、Gateway の public URL に
/googlechatを付けた URL を設定します。- ヒント:
openclaw statusで Gateway の public URL を確認できます。
- ヒント:
- Visibility で Make this Chat app available to specific people and groups in <Your Domain> をチェックします。
- メールアドレス(例:
user@example.com)を入力します。 - 下部の Save をクリックします。
- Application info を入力します。
- アプリのステータスを有効化します。
- 保存後、ページをリロードします。
- App status セクションを探します(保存後は上部または下部に表示されることが多いです)。
- ステータスを Live - available to users に変更します。
- もう一度 Save をクリックします。
- OpenClaw にサービスアカウントファイルのパスと Webhook audience を設定します。
- Env:
GOOGLE_CHAT_SERVICE_ACCOUNT_FILE=/path/to/service-account.json - または config:
channels.googlechat.serviceAccountFile: "/path/to/service-account.json"
- Env:
- Webhook audience の type と value を設定します(Chat アプリ設定と一致させます)。
- Gateway を起動します。Google Chat は Webhook パスに POST します。
Google Chat へ追加
Gateway が動いていて、あなたのメールが visibility list に入っている前提です。
- Google Chat を開きます。
- Direct Messages の横の +(プラス)をクリックします。
- 検索バー(普段ユーザーを追加するときの欄)に、Google Cloud Console で設定した App name を入力します。
- Note:このボットは private app のため、Marketplace の browse list には表示されません。名前で検索する必要があります。
- 検索結果からボットを選びます。
- Add または Chat をクリックして 1:1 を開始します。
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 のみを公開できます。
- Gateway の bind アドレスを確認します:
ss -tlnp | grep 18789
IP アドレス(例:
127.0.0.1、0.0.0.0、または100.x.x.xのような Tailscale IP)を控えます。 - ダッシュボードを 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
- 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
- 求められた場合、出力にある authorization URL にアクセスして Funnel を許可します。
- 設定を確認します:
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 reset と tailscale 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:
/googlechat→http://localhost:18789/googlechat - Default Rule:HTTP 404(Not Found)
How it works
- Google Chat は gateway に Webhook POST を送ります。各リクエストには
Authorization: Bearer <token>が含まれます。- OpenClaw は、ヘッダーがある場合、Webhook body 全体を読む/パースする前に bearer auth を検証します。
- body に
authorizationEventObject.systemIdTokenを含む Google Workspace Add-on リクエストは、より厳格な pre-auth body budget でサポートされます。
- OpenClaw は設定された
audienceType+audienceに対してトークンを検証します。audienceType: "app-url"→ audience は HTTPS webhook URLaudienceType: "project-number"→ audience は Cloud project number
- メッセージは space ごとにルーティングされます。
- DM:session key
agent:<agentId>:googlechat:direct:<spaceId> - Spaces:session key
agent:<agentId>:googlechat:group:<spaceId>
- DM:session key
- DM はデフォルトで pairing です。不明な送信者には pairing code が返り、次で承認します:
openclaw pairing approve googlechat <code>
- グループスペースはデフォルトで @メンションが必要です。メンション検出にアプリの 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: "allowlist",
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から利用できます。 typingIndicatorはnone/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 が登録されていないことを示します。よくある原因:
- Channel not configured:config に
channels.googlechatがありません。次で確認:openclaw config get channels.googlechat
Config path not foundが返る場合、設定を追加してください(Config highlights参照)。 - Plugin not enabled:プラグイン状態を確認:
openclaw plugins list | grep googlechat
disabledと出る場合、config にplugins.entries.googlechat.enabled: trueを追加します。 - 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:
参考
関連記事

AIエージェントのメモリスタックとは?2026年に重要度が上がる理由をやさしく解説
2026年4月8日
OpenClaw vs Hermes vs Claude、創業者はどれを選ぶべき?2026年版の実務比較
2026年4月8日