Skip to content

feat(channels): add Google Chat channel with Pub/Sub pull and Cards V2#196

Open
duhd-vnpay wants to merge 1 commit intonextlevelbuilder:mainfrom
duhd-vnpay:feat/google-chat-channel
Open

feat(channels): add Google Chat channel with Pub/Sub pull and Cards V2#196
duhd-vnpay wants to merge 1 commit intonextlevelbuilder:mainfrom
duhd-vnpay:feat/google-chat-channel

Conversation

@duhd-vnpay
Copy link

@duhd-vnpay duhd-vnpay commented Mar 14, 2026

Summary

  • New Google Chat channel implementation with Pub/Sub pull mode for receiving messages
  • Cards V2 rich formatting with markdown-to-card conversion
  • Drive upload for long-form responses (configurable threshold)
  • Streaming: progressive message editing for DMs and groups (configurable per type)
  • Service account auth with auto-refresh, media handling (download + Drive upload)
  • DM/group policy controls, @mention toggle, allowlist support
  • Full Web Dashboard integration: credentials form, config schema, channel type selector

Architecture

internal/channels/googlechat/
├── googlechat.go      # Channel struct, lifecycle (Start/Stop)
├── factory.go         # Channel instance factory (DB-driven)
├── auth.go            # Service account JWT + token refresh
├── pubsub.go          # Pub/Sub pull loop + message routing
├── webhook.go         # Webhook stub (phase 2)
├── send.go            # Message sending (text, cards, Drive)
├── format.go          # Markdown → Cards V2 conversion
├── media.go           # Media download/upload (Chat API + Drive)
├── stream.go          # Streaming (edit-in-place with throttle)
├── constants.go       # Config defaults, API URLs
└── *_test.go          # Unit tests (auth, format, pubsub, send, stream)

No new Go dependencies — uses existing google/uuid, net/http, golang.org/x/oauth2.

Changes (v2 — rebased on latest main)

  • Rebased on upstream main (32ced98) to resolve all conflicts
  • Cleaned up: only Google Chat changes, no unrelated modifications
  • 20 files changed, 3525 insertions

Config example

{
  "channels": {
    "google_chat": {
      "enabled": true,
      "serviceAccountFile": "/app/config/google-sa.json",
      "mode": "pubsub",
      "projectId": "my-project",
      "subscriptionId": "my-chat-sub",
      "pullIntervalMs": 3000,
      "dm_stream": true,
      "group_stream": false
    }
  }
}

Test plan

  • go build ./cmd/ passes (Linux target)
  • Unit tests in internal/channels/googlechat/
  • Manual test with GCP service account + Pub/Sub subscription
  • Verify Cards V2 rendering in Google Chat client

Add a new Google Chat channel implementation supporting:
- Pub/Sub pull mode for receiving messages (webhook mode planned for phase 2)
- Google Cards V2 rich message formatting with markdown conversion
- Drive file upload for long-form responses (configurable threshold)
- Media handling: image/file download from Chat API, upload via Drive
- Streaming support: progressive message editing for DMs and groups
- Service account authentication with auto-refresh
- DM/group policy controls (open, allowlist, disabled)
- @bot mention requirement toggle for group chats
- Full UI integration: credentials form, config schema, channel type

New files: internal/channels/googlechat/ (15 files including tests)
Modified: channel.go (TypeGoogleChat const), config_channels.go (GoogleChatConfig),
  gateway_channels_setup.go (registration), UI channel types + schemas

No new Go dependencies required (uses existing google/uuid, net/http, oauth2).
@duhd-vnpay duhd-vnpay force-pushed the feat/google-chat-channel branch from abe07b2 to ecb93ca Compare March 20, 2026 16:12
@duhd-vnpay duhd-vnpay changed the title feat: add Google Chat channel with Pub/Sub pull, Cards V2, Drive upload feat(channels): add Google Chat channel with Pub/Sub pull and Cards V2 Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants