Channels & Messaging Business Messaging

OpenClaw Google Chat: Connect AI Agents to Your Workspace Fast

Google Chat is where 3 billion Google Workspace users collaborate — and most teams still answer every question manually. OpenClaw changes that by deploying an AI agent directly into your Spaces and DMs, responding to @mentions, handling slash commands, and surfacing answers your team would otherwise spend 20 minutes digging for. This guide gets you live in one session.

TC
T. Chen
Google Workspace Integration Lead
Feb 12, 2025 14 min read 7.8k views
Updated Feb 12, 2025
Key Takeaways
  • OpenClaw connects to Google Chat via the Chat API — create a bot in Google Cloud Console, configure a service account, and point the webhook at your OpenClaw endpoint.
  • Service account authentication is the correct approach for production — no token expiry, no user interaction required, precise scope control.
  • The bot works in both Spaces (responds to @mentions) and DMs (responds to every message) — configure each context separately in openclaw.config.js.
  • Slash commands are registered in Google Cloud and routed in OpenClaw's config — both sides must match for commands to work.
  • As of early 2025, Google Chat Cards v2 is fully supported in OpenClaw's adapter — use structured card responses to display rich data from your agents.

Google Chat sits inside Workspace, which means your AI agent doesn't just answer questions — it operates inside the same environment where your team manages documents, calendars, and projects. A well-configured OpenClaw agent on Google Chat becomes the team's first point of contact for any question that has a findable answer.

Why Google Chat Is the Right Deployment Target

Slack gets more attention in the AI agent space, but Google Chat has a structural advantage: it's natively integrated with Google Workspace. An OpenClaw agent in Chat can reference context that a Slack bot never has — same ecosystem, same user identities, same document access patterns.

Here's what we've seen consistently: teams deploying OpenClaw on Google Chat see the highest adoption rates of any channel. The reason is distribution. Employees already have Chat open all day. Adding an AI agent to their existing Space feels natural, not like adopting new tooling.

ℹ️
Workspace Admin Permissions

Before you build, confirm your Workspace admin has enabled Chat app installation in the Google Admin console (Apps → Google Workspace → Google Chat → Chat apps). Without this setting, users can't add your bot to Spaces regardless of how perfectly it's configured.

The architecture is clean: Google's Chat API sends message events to your OpenClaw webhook URL via HTTP POST. OpenClaw processes the event, calls your configured AI model, and returns a response payload. Google Chat renders the response in the Space or DM. No persistent connection, no polling.

Google Cloud Bot Setup

Every Google Chat bot starts as a Google Cloud project with the Chat API enabled. Here's the exact sequence.

  1. Open console.cloud.google.com and create a new project.
  2. Navigate to APIs & Services → Library. Search "Google Chat API" and enable it.
  3. Go to APIs & Services → Google Chat API → Configuration.
  4. Fill in the bot name, description, and avatar URL. These appear to users when they interact with your bot.
  5. Set the Connection Settings to "App URL" and enter your OpenClaw webhook URL: https://yourdomain.com/webhooks/google-chat
  6. Under Slash Commands, add any commands you want to support (covered in section 5).
  7. Save. Google Cloud generates a unique App ID for your bot.
⚠️
Publish Scope: Internal vs External

Set your app's publish status to "Internal" during development and testing — this limits the bot to accounts within your Workspace domain. Switch to "External" only when you're ready for public deployment. External apps visible outside your domain require Google verification for sensitive scopes.

Service Account Authentication

Unlike OAuth flows that require a user to grant access interactively, service accounts authenticate server-to-server. For OpenClaw running as a background service, this is the right approach.

  1. In Google Cloud Console, go to IAM & Admin → Service Accounts.
  2. Click "Create Service Account." Give it a descriptive name: openclaw-chat-agent.
  3. Grant it the "Chat Bot" role (roles/chat.bot).
  4. Create a key for the service account: Actions → Manage Keys → Add Key → JSON.
  5. Download the key file. Store it outside your codebase — reference it via environment variable.
# Environment variable setup
export GOOGLE_CHAT_SERVICE_ACCOUNT_KEY=/path/to/service-account-key.json
export GOOGLE_CHAT_PROJECT_NUMBER=123456789

# Start OpenClaw with Google Chat channel
openclaw start --channel google-chat

OpenClaw Channel Configuration

With your bot registered and service account ready, configure the Google Chat channel in OpenClaw.

// openclaw.config.js
module.exports = {
  channels: {
    googleChat: {
      enabled: true,
      serviceAccountKeyPath: process.env.GOOGLE_CHAT_SERVICE_ACCOUNT_KEY,
      projectNumber: process.env.GOOGLE_CHAT_PROJECT_NUMBER,
      spaceAgentId: 'workspace-assistant',
      dmAgentId: 'personal-assistant',
      respondToMentions: true,
      respondToDMs: true,
      threadedReplies: true
    }
  },
  agents: {
    'workspace-assistant': {
      model: 'gpt-4o',
      systemPrompt: 'You are a helpful Workspace assistant...',
      maxTokens: 600
    },
    'personal-assistant': {
      model: 'gpt-4o',
      systemPrompt: 'You are a personal productivity assistant...',
      maxTokens: 400
    }
  }
};

The threadedReplies: true setting is important. When enabled, OpenClaw posts replies as thread replies rather than new Space messages. This keeps conversations tidy and prevents the agent from spamming the main Space feed.

Slash Commands and Cards v2

Slash commands give users a structured way to invoke specific agent capabilities. Instead of typing natural language, a user types /summarize or /lookup order-1234 and gets a precise, formatted response.

Command Handler Response Type
/help helpHandler Card with command list
/summarize summarizeAgent Text summary
/lookup lookupAgent Card with structured data
/status statusHandler Card with system status
💡
Use Cards for Data-Heavy Responses

Plain text replies work for conversational answers. For data lookups, status reports, or any response with multiple distinct pieces of information, return a Cards v2 object. Structured cards are significantly easier to scan than a wall of formatted text in a Chat message.

Common Mistakes

  • Not enabling the Chat API before creating the bot config. The bot configuration screen in Google Cloud only appears after the Chat API is enabled. Enable it first — otherwise you're looking at a blank APIs page.
  • Forgetting threadedReplies in busy Spaces. Without threaded replies, every agent response posts as a new top-level message. In an active Space, this floods the feed and makes the bot feel disruptive.
  • Mismatched slash command IDs. Slash commands have numeric IDs in Google Cloud. The ID in your OpenClaw slash_commands config must match the ID registered in Google Cloud exactly. A mismatch means the command triggers no handler.
  • Using the Chat API before Workspace admin enables bot installation. Your bot can be perfectly configured and still fail to appear in the add-member search if the admin hasn't enabled Chat app installation for your domain.
  • Responding to your own bot's messages. OpenClaw's Google Chat adapter ignores messages from bot senders by default. Make sure this setting is not accidentally disabled — without it, your agent loops by responding to its own replies.

Testing Before Full Deployment

Test your Google Chat bot by adding it to a private Space with only your own account. Send a direct @mention and check your OpenClaw logs — you should see the incoming event, the model call, and the outgoing response payload within 2–3 seconds.

Test slash commands individually. Each command should trigger its mapped handler and return the expected response type. Cards v2 responses are easiest to validate visually — if the card structure is malformed, Google Chat renders an error inline.

Once the private Space tests pass, add a small internal team for broader testing. Watch for edge cases: empty messages, very long messages, messages containing only emojis, and @mentions with no text following them. Your agent needs a graceful fallback for each.

Frequently Asked Questions

Does OpenClaw work in Google Chat Spaces and direct messages?

Yes, both. In Spaces, the bot responds to @mentions and slash commands. In direct messages, every message from a user triggers the agent. Configure separate agentId values for each context if you want different behavior in DMs versus Spaces.

Do I need a Google Workspace account to use OpenClaw with Google Chat?

Yes. Google Chat bots require a Google Workspace account with Chat API access. Personal Gmail accounts cannot publish Chat bots. Your Workspace admin may need to enable third-party app installation in the Admin console before you can deploy.

How do I add the OpenClaw bot to a specific Google Chat Space?

In Google Chat, open the Space, click the member count, select 'Add people and bots', and search for your bot by name. The bot must be published (internal or external) in your Google Cloud project before it appears in the search results.

Can OpenClaw respond to slash commands in Google Chat?

Yes. Define slash commands in your Google Cloud Chat API configuration. OpenClaw's slash_commands map in the channel config routes each command to a specific agent or handler function. Commands must be registered in Google Cloud before they work.

What happens if OpenClaw's response exceeds Google Chat's message limit?

Google Chat messages are limited to 4,096 characters. OpenClaw's Google Chat adapter automatically splits responses that exceed this limit into sequential messages. Set max_message_length in your config to control splitting behavior.

Can I use Google Chat Cards (rich UI) with OpenClaw?

Yes. OpenClaw's Google Chat adapter supports Cards v2, including sections, buttons, text paragraphs, and decoratedText widgets. Return a card object from your agent's response handler and the adapter renders it natively in Chat.

Is service account authentication safer than OAuth for Google Chat?

For server-to-server communication, service accounts are the correct approach. They don't require user interaction for authentication, don't expire like OAuth tokens, and can be scoped precisely. Use service accounts for production OpenClaw deployments.

TC
T. Chen
Google Workspace Integration Lead

T. Chen has architected Google Workspace integrations for enterprise teams across financial services and healthcare. He has deployed OpenClaw on Google Chat for organisations with 500+ daily active users, and has deep expertise in Chat API permissions, Cards v2 design patterns, and service account security hardening.

Google Workspace Guides

Weekly OpenClaw integration tips, free.