# Google Chat

> Connect a Lobu agent to Google Chat as a Workspace app.

Lobu's Google Chat adapter supports direct messages, space mentions, and interactive workflows.
Under the hood, Lobu uses `@chat-adapter/gchat` with the Google Chat API and Workspace Events.

<PlatformChatExamples platform="gchat" client:visible />


## Setup

1. Create a Google Cloud project and enable the **Google Chat API** and **Workspace Events API**.
2. Create a **service account** with the Chat Bot role, and download the JSON key file.
3. In the [Google Chat API configuration](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat), configure the app:
   - Set the **App URL** to your gateway's webhook endpoint: `https://your-gateway/api/v1/webhooks/{connectionId}`
   - Enable **Interactive features** and configure the connection settings.
4. Run `lobu connections add gchat` to add the connection (prompts for the service account JSON), or run `lobu init` to scaffold a new project and pick Google Chat in the wizard.

## Configuration

<PlatformConfigTable platform="gchat" />

## Authentication

The adapter supports three authentication modes:

- **Service account JSON** (default) — provide `credentials` with the JSON key contents.
- **Application Default Credentials (ADC)** — set `useApplicationDefaultCredentials: true`. Works with GCE, Cloud Run, Workload Identity Federation, or local `gcloud auth application-default login`.
- **Custom auth client** — for advanced use cases (programmatic only via the SDK).

## Features

- **Direct messages** and **space @mentions** trigger the agent.
- **Streaming responses** with throttled message edits.
- **Google Chat Cards v2** for interactive elements (buttons, permission grants, configuration).
- **Workspace Events integration** — subscribes to spaces for real-time message delivery.
- **Pub/Sub support** — receive events via Google Cloud Pub/Sub push subscriptions.
- **Access control** — restrict which users or groups can interact.

## Typical Use Cases

- Internal assistant accessible from Google Workspace.
- Workflow automation triggered by team conversations in Google Chat spaces.
- Knowledge base bot for organizations using Google Workspace.
