---
title: "Connect Google Chat"
description: "Set up a Google Chat app in Google Cloud, connect it to HolaClaw Server, and talk to your agent in a direct message or a Chat space."
updated: 2026-11-17
canonical: https://holaclaw.ai/docs/server/connect-google-chat
---

This guide connects your HolaClaw Server agent to Google Chat, so you and your team can talk to it in a direct message or in a Chat space. You set up Google Cloud once, give HolaClaw the key it creates, and invite people.

Chat sends the app's messages to a Cloud Pub/Sub topic, and HolaClaw pulls them from a subscription. Replies go back through the Chat API. The server needs no public address and no open port.

Commands are written as `holaclaw …`. Run them [the way your deployment does](/docs/server/choose-a-deployment#where-things-are), for example `docker exec -i holaclaw holaclaw …` in the container.

## What you need

- **A Google Workspace account** (Business or Enterprise) allowed to use Chat apps. A personal `@gmail.com` account cannot host a Chat app.
- **A Google Cloud project with billing enabled.** Pub/Sub needs a billing account. A bot's traffic stays inside the free tier.
- **Permission to edit that project**, for the one-time setup.
- **HolaClaw Server running** on a machine that can reach Google.

## Step 1: Set up Google Cloud

Do this once, in the [Google Cloud console](https://console.cloud.google.com). Check that the right project is selected at the top of each page.

### Create the project and enable the APIs

1. [Create a project](https://console.cloud.google.com/projectcreate), or reuse one, and link a billing account: **Billing**, then **Link a billing account**.
2. [Enable the Google Chat API and the Cloud Pub/Sub API](https://console.cloud.google.com/flows/enableapi?apiid=chat.googleapis.com,pubsub.googleapis.com).

### Create the service account and its key

1. Go to **IAM & Admin**, then **Service accounts**, then **Create**. Name it `holaclaw` and grant it **no project roles**: it gets only the one grant below.
2. Open the account, then **Keys**, **Add key**, **JSON**. Keep the downloaded file: it is the key you give HolaClaw.

If the console says service account key creation is disabled, see [If the console blocks a step](#if-the-console-blocks-a-step).

### Create the topic

Chat publishes its events here.

1. Go to **Pub/Sub**, then **Topics**, then **Create topic**. Name it `holaclaw`, untick **Add a default subscription**, and create it.
2. In the topic list, tick the **checkbox** next to `holaclaw` (do not click its name). Click **Show info panel** if the panel is hidden, then **Add principal**.
3. Principal: `chat-api-push@system.gserviceaccount.com`. Role: **Pub/Sub Publisher**. Click **Save**.

If the console says the **Domain-restricted sharing** policy is enforced, see [If the console blocks a step](#if-the-console-blocks-a-step).

To check the grant, open Cloud Shell (the `>_` icon at the top right) and run:

```sh
gcloud pubsub topics get-iam-policy holaclaw
```

It must list `roles/pubsub.publisher` for `chat-api-push@system.gserviceaccount.com`.

### Create the subscription

HolaClaw pulls the events from here.

1. Go to **Pub/Sub**, then **Subscriptions**, then **Create subscription**. Name it exactly `holaclaw`: HolaClaw always looks for that name. Topic `holaclaw`, delivery type **Pull**, acknowledgement deadline 60 seconds, expiration **Never expire**. Create it.
2. In the subscription list, tick the **checkbox** next to `holaclaw`, open the info panel, and click **Add principal**. This grant goes on the subscription, not the topic.
3. Principal: the service account's email, the `client_email` field in the key file (`holaclaw@<project>.iam.gserviceaccount.com`). Role: **Pub/Sub Subscriber**. Click **Save**.

To check it:

```sh
gcloud pubsub subscriptions get-iam-policy holaclaw
```

It must list `roles/pubsub.subscriber` for the service account.

### Configure the Chat app

Open [the Google Chat API configuration](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat) (**APIs & Services**, **Google Chat API**, **Configuration**). This step has no API, so it is always done here.

1. Untick **Build this Chat app as a Google Workspace add-on**.
2. Fill in the app name, avatar URL and description. People find the app by its name.
3. Turn on **Interactive features** and tick **Join spaces and group conversations**. Without it, the app works in direct messages only.
4. Under **Connection settings**, choose **Cloud Pub/Sub** and enter the topic as `projects/<project>/topics/holaclaw`.
5. Under **Visibility**, add the people or groups in your domain who may find and message the app.
6. Click **Save**.

Visibility is a gate in front of HolaClaw's own access settings: only the people listed there can reach the app at all.

### If the console blocks a step

Organizations created since 2024 enforce two policies by default that block the key and the topic grant. Lift each one for the bot's project only, never for the whole organization. You need the **Organization Policy Administrator** role on the organization, which a Workspace super admin does not have by default: grant it to yourself in **IAM & Admin**, **IAM** with the organization selected, or ask your Google Cloud administrator.

**Key creation is disabled.**

1. Select the bot's **project** (not the organization) and open [**IAM & Admin**, **Organization policies**](https://console.cloud.google.com/iam-admin/orgpolicies).
2. Filter for `disableServiceAccountKeyCreation`. You may see **Disable service account key creation** (`iam.managed.disableServiceAccountKeyCreation`) and a legacy one (`iam.disableServiceAccountKeyCreation`).
3. For each one that shows **Enforced**: open it, click **Manage policy**, choose **Override parent's policy**, set the rule's **Enforcement** to **Off**, and click **Set policy**.
4. Wait a few minutes, then create the key. Keep this exception: you need it again to rotate the key.

**Domain-restricted sharing blocks the topic grant.** Chat publishes as a Google account outside your domain, which this policy refuses.

1. With the bot's project selected, open **Organization policies** and find the policy your error names: **Domain restricted sharing** (`iam.allowedPolicyMemberDomains`) or **Restrict allowed policy members in IAM allow policies** (`iam.managed.allowedPolicyMembers`).
2. Click **Manage policy** and choose **Override parent's policy**. For `iam.allowedPolicyMemberDomains`, under **Policy enforcement** choose **Replace** and add a rule set to **Allow All**. For `iam.managed.allowedPolicyMembers`, set the rule's **Enforcement** to **Off**. Click **Set policy**.
3. Wait a few minutes, then add the publisher grant to the topic.
4. Restore the policy: **Manage policy**, **Inherit parent's policy**, **Set policy**. The grant you made stays.

## Step 2: Add the channel

Add a channel instance to `channels.toml`:

```toml title="channels.toml"
version = 1

[channels.googlechat]
type  = "googlechat"
agent = "main"

[channels.googlechat.access]
dm    = "invite"
rooms = "approved"
reply = "mention"
```

Keep `reply = "mention"`: in a space, Chat delivers only messages that mention the app, so `always` can never fire, and `holaclaw check` warns `ACC003`. In a direct message every message reaches the app. Every key is in the [channels.toml reference](/docs/server/channels-toml#keys).

The key names its Cloud project and HolaClaw always uses the `holaclaw` subscription in it, so `channels.toml` needs no project id. A second bot needs its own Cloud project and its own channel instance.

## Step 3: Store the key

Pipe the JSON key file into `auth set`:

```sh
holaclaw auth set channels.googlechat service_account < holaclaw-key.json
```

In the container, use `docker exec -i holaclaw holaclaw auth set …` so the file reaches it. `auth set` checks the key with Google before it stores it, and on a failure stores nothing and names what to fix:

| `auth set` says | What to do |
| --- | --- |
| "is not a service-account key" | You piped the wrong file, or a truncated one. Download the key again. |
| "Google rejected this key" | The key or the service account was deleted or disabled. Create a new key. |
| "no subscription `holaclaw` in project …" | Create the subscription, named exactly `holaclaw`, in the key's project. |
| "cannot pull from subscription `holaclaw`" | Add the **Pub/Sub Subscriber** grant on the subscription for the key's `client_email`. A new grant can take a few minutes. |
| "the Chat app is not configured" | Complete and save the Chat app configuration. |
| "could not reach Google … storing it unchecked" | The key is stored. Check `holaclaw status` once the machine can reach Google. |

`--no-verify` skips the check. Leave it on: it catches setup mistakes that would otherwise show up only later.

## Step 4: Restart and check

The daemon reads `channels.toml` only at start, so restart it ([restart command for your deployment](/docs/server/choose-a-deployment#where-things-are)). Then:

```sh
holaclaw check
holaclaw status
```

`check` fails with `SEC003` if the key is missing. In `status`, the channel turns `connected` within a second or two.

| Status | Meaning |
| --- | --- |
| `unlinked` | No key is set. Run `auth set`; no restart needed. |
| `connected` | The key can pull from the subscription. |
| `logged_out` | Google refused the key, or it cannot pull from the subscription. The detail says which. HolaClaw retries every 60 seconds, so fixing the key or the grant is enough. |
| `reconnecting` | Any other failure, including a missing subscription. HolaClaw retries with backoff. |

## Step 5: Talk to the app

Start with yourself. Find your identity id and mint an invite:

```sh
holaclaw identity list
holaclaw invite create --identity <owner id> --channel googlechat
```

It prints the code and its expiry. Then:

1. Open [Google Chat](https://chat.google.com), or Chat in Gmail.
2. Click **New chat**, type the app's name and pick it. If it does not show up, your account is not in the app's Visibility list yet, or the change has not reached Chat.
3. Send the code as the only text of the message.

The app links your Chat account and answers. The code works once, for 15 minutes by default, and is never shown to the agent.

> [!WARNING] An owner code is for the owner
> Whoever redeems an invite acts as that identity. Never send a code minted for your own identity to someone else.

For anyone else, create their identity with its first code. Add `--role admin` for someone who should approve tool calls from Chat:

```sh
holaclaw identity create --name Carla --invite googlechat
```

[Invite people](/docs/server/invite-people) covers roles and removing access.

## Add the app to a space

In a space, the app sees only messages that mention it, and answers only once the space is approved.

- **As a linked owner or admin**, open the space, then the space name, **Apps & integrations**, **Add apps**, and pick the app. Adding it approves the space, and the app posts "This room is approved. Say hi!". You can also mention the app in the space and confirm when Chat asks whether to add it.
- **With a room invite**, which anyone can send:

  ```sh
  holaclaw invite create --room --channel googlechat
  ```

  In the space, type `@` and the app's name, pick it, then the code, and send. That approves the space and links nobody.

If someone else adds the app, it joins but stays silent until the space is approved. People in an approved space who have no invite of their own talk to the agent as guests.

## Daily use

- **Mention the app in spaces.** Every turn in a space starts with `@app`. A top-level message and each thread are separate conversations.
- **Approvals arrive as cards** with four buttons: once, session, always and deny. Only an owner's or admin's press counts. The card then shows the outcome.
- **Files come in, not out.** Images and documents sent to the app reach the agent, up to 20 MiB. Files kept in Drive are not downloaded. The app cannot send files back.
- **No typing indicator.** Chat has no API for it.
- **Long replies** are split at 4000 characters. Chat allows 60 messages per space per minute.
- **Downtime.** Pub/Sub keeps undelivered events for 7 days. A daemon down longer loses what arrived meanwhile.

## Rotate the key

The key can only pull from the one subscription and post as the app. Rotating it needs no restart:

1. In the console, open the `holaclaw` service account, then **Keys**, **Add key**, **JSON**.
2. Store the new key: `holaclaw auth set channels.googlechat service_account < new-key.json`. The daemon picks it up at once.
3. Once `status` shows `connected`, delete the old key in the console.

## Troubleshooting

| Symptom | What to check |
| --- | --- |
| The app cannot be found in Chat | Your account is not in **Visibility**, or a recent change has not reached Chat. It can take a few minutes. |
| The app cannot be added to a space | Tick **Join spaces and group conversations** in the Chat app configuration. |
| `connected`, but nothing happens when you message the app | In order: the topic grants **Pub/Sub Publisher** to `chat-api-push@system.gserviceaccount.com`; the Chat app's connection names `projects/<project>/topics/holaclaw` exactly; the subscription is named exactly `holaclaw`. |

## Next steps

- [Invite people](/docs/server/invite-people) and give them roles.
- Add another channel: [Telegram](/docs/server/connect-telegram), [WhatsApp](/docs/server/connect-whatsapp) or [Slack](/docs/server/connect-slack).
- [channels.toml reference](/docs/server/channels-toml)

