Skip to content

Google Chat: Add user OAuth support for reactions and media uploads #9764

@ndohuu

Description

@ndohuu

Summary

The Google Chat channel currently only supports Service Account authentication (scope chat.bot). This limits functionality:

  • Reactionsspaces.messages.reactions.create requires user-level OAuth scopes
  • Media uploadsattachments:upload fails with service account auth
  • Proactive DMs — cannot initiate DMs using email aliases (403: "Service account authentication doesn't support access to user information using email aliases")
  • ✅ Text messages and links work fine
  • ✅ Receiving messages via webhook works fine

Proposal

Add optional user OAuth flow alongside the existing Service Account auth for Google Chat.

Suggested approach

  1. Add a userOAuth config section under channels.googlechat for user-level credentials (client ID, client secret, refresh token)
  2. Use the user OAuth token for operations that require user-level scopes (reactions, attachments, proactive DMs)
  3. Keep Service Account for webhook verification and bot-level operations (receiving messages, sending replies in existing spaces)
  4. Fall back gracefully: if no user OAuth is configured, skip unsupported operations with a warning

Required scopes

  • https://www.googleapis.com/auth/chat.messages.reactions.create
  • https://www.googleapis.com/auth/chat.messages.reactions.readonly
  • https://www.googleapis.com/auth/chat.messages (for attachments and proactive DMs)

Config sketch

{
  channels: {
    googlechat: {
      // existing service account config (keep as-is)
      serviceAccountFile: "/path/to/sa.json",
      
      // new: user OAuth for enhanced operations
      userOAuth: {
        clientId: "...",
        clientSecret: "...",
        refreshToken: "...",
      }
    }
  }
}

Context

  • The code already has createGoogleChatReaction() and uploadGoogleChatAttachment() in extensions/googlechat/src/api.ts — they work structurally but fail at runtime due to insufficient scope
  • typingIndicator: "reaction" also requires user OAuth (noted in monitor.ts line 697)
  • Proactive DMs via findDirectMessage require user auth to resolve email aliases

Environment

  • OpenClaw 2026.2.1
  • Google Chat app configured via webhook + Service Account
  • Tested with GCP project using Chat API v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions