# Google Chat Integration

## Overview

This documentation covers setting up OpenClaw's Google Chat integration via the Chat API with webhook support for direct messages and spaces.

## Setup Steps

### 1. Google Cloud Project

Enable the Chat API and create service account credentials, downloading a JSON key file for authentication.

### 2. Chat App Configuration

Register the app in Google Cloud Console with basic info (name, avatar, description), enable interactive features, and configure an HTTP endpoint.

### 3. Webhook Configuration

Set the endpoint to your gateway's public URL with "/googlechat" path and establish visibility restrictions to specific users.

### 4. App Status Activation

After saving, refresh and change app status to "Live" for user availability.

### 5. OpenClaw Configuration

Configure the service account file path and webhook audience settings via environment variables or config files.

### 6. Adding to Chat

Users can find the private app by searching its name in Google Chat and start conversations.

## Security Architecture

Only expose the `/googlechat` path to the internet. Three recommended approaches:

### Tailscale Funnel

Combines private dashboard access via Serve with public webhook exposure via Funnel.

### Reverse Proxy (Caddy)

Routes only the specific webhook path while blocking other requests.

### Cloudflare Tunnel

Configures ingress rules limiting access to the webhook endpoint.

## Message Routing

Messages are processed through space-based routing using session keys that differentiate between direct messages and group spaces.

- **Direct messages** employ pairing by default requiring approval codes
- **Group spaces** require @-mentions unless configured otherwise

## Configuration Options

The system supports:

- Service account authentication
- Optional bot user identification
- Group allowlisting
- Reaction handling
- Typing indicators
- Media attachments up to a configurable size limit
