Skip to content

feat(google-chat): add Google Chat integration with OAuth#3339

Open
waleedlatif1 wants to merge 7 commits intostagingfrom
waleedlatif1/add-google-chat
Open

feat(google-chat): add Google Chat integration with OAuth#3339
waleedlatif1 wants to merge 7 commits intostagingfrom
waleedlatif1/add-google-chat

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add Google Chat integration with OAuth (send message, list spaces)
  • Register google-chat OAuth provider under Google with chat.spaces.readonly and chat.messages.create scopes
  • Add scope descriptions to oauth-required-modal
  • Add GoogleChatIcon, block config, tool registry entries, and generated docs

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 27, 2026 7:18pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 25, 2026

Greptile Summary

This PR adds a Google Chat integration with OAuth, enabling two operations: Send Message (post to a space with optional thread key) and List Spaces (enumerate spaces the user is a member of). The OAuth provider is correctly registered in auth.ts and oauth.ts under the existing Google provider group, tools are registered in both the tool and block registries, and scope descriptions for the two new Chat scopes are added to the OAuth required modal.

  • Tools, block config, icon, and documentation all follow established patterns for Google integrations
  • OAuth registration correctly reuses GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET, consistent with other Google services
  • pageToken is fully implemented in list_spaces.ts (correctly appended to the API request URL) but is not wired through the block config — inputs, subBlocks, and the params function for list_spaces all omit it, making pagination non-functional at the block level despite the block advertising nextPageToken as an output

Confidence Score: 4/5

Safe to merge after fixing pageToken wiring — current code silently drops pagination tokens making list_spaces pagination non-functional

One P1 defect: the block config for list_spaces omits pageToken from inputs, subBlocks, and the params function, so the block's own nextPageToken output can never be used for subsequent page fetches. All other integration components (tools, OAuth registration, icon, docs) are correctly implemented and follow established patterns.

apps/sim/blocks/blocks/google_chat.ts — missing pageToken in inputs, subBlocks, and params for the list_spaces operation

Important Files Changed

Filename Overview
apps/sim/tools/google_chat/types.ts Clean type definitions for send-message and list-spaces params/response; optional fields correctly typed
apps/sim/tools/google_chat/send_message.ts Well-implemented send-message tool with correct threadKey URL parameter and body construction
apps/sim/tools/google_chat/list_spaces.ts Correct list-spaces tool; pageToken is properly forwarded to the API — the gap is only in the block config
apps/sim/tools/google_chat/index.ts Barrel export for google_chat tools following existing conventions
apps/sim/blocks/blocks/google_chat.ts Block config missing pageToken in inputs, subBlocks, and params function — list_spaces pagination is non-functional
apps/sim/blocks/registry.ts GoogleChatBlock registered alphabetically in the block registry
apps/sim/tools/registry.ts Both google_chat tools registered correctly in the tool registry
apps/sim/lib/oauth/oauth.ts google-chat service added under Google provider with correct scopes, icon, and description
apps/sim/lib/oauth/types.ts google-chat added to both OAuthProvider and OAuthService union types
apps/sim/lib/auth/auth.ts google-chat OAuth provider registered with correct scopes, discoveryUrl, prompt, and redirectURI
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx Scope descriptions added for chat.spaces.readonly and chat.messages.create
apps/sim/components/icons.tsx GoogleChatIcon SVG added following existing icon patterns
apps/docs/content/docs/en/tools/google_chat.mdx Documentation for both tools with correct input/output parameter tables

Sequence Diagram

sequenceDiagram
    participant U as User/Workflow
    participant B as GoogleChatBlock
    participant T as Tool
    participant G as Google Chat API

    U->>B: operation=send_message
    B->>T: google_chat_send_message(spaceId, message, threadKey?)
    T->>G: POST /v1/spaces/{space}/messages
    G-->>T: { name, space, thread, text, createTime }
    T-->>B: { messageName, spaceName, threadName, text, createTime }
    B-->>U: outputs

    U->>B: operation=list_spaces
    B->>T: google_chat_list_spaces(pageSize?, filter?)
    Note over B,T: pageToken silently dropped — pagination broken
    T->>G: GET /v1/spaces?pageSize&filter
    G-->>T: { spaces[], nextPageToken }
    T-->>B: { spaces, nextPageToken }
    B-->>U: outputs (nextPageToken cannot be reused)
Loading

Reviews (3): Last reviewed commit: "lint" | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Comment thread apps/sim/blocks/blocks/google_chat.ts Outdated
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread apps/sim/lib/oauth/oauth.ts
…oogle-chat

# Conflicts:
#	apps/docs/components/icons.tsx
#	apps/docs/components/ui/icon-mapping.ts
#	apps/docs/content/docs/en/tools/meta.json
#	apps/sim/blocks/registry.ts
#	apps/sim/components/icons.tsx
#	apps/sim/lib/auth/auth.ts
#	apps/sim/lib/oauth/oauth.ts
#	apps/sim/tools/registry.ts
@waleedlatif1 waleedlatif1 deleted the branch staging April 3, 2026 23:01
@waleedlatif1 waleedlatif1 reopened this Apr 7, 2026
Comment on lines +116 to +121
case 'list_spaces':
return {
oauthCredential,
pageSize: rest.pageSize ? Number(rest.pageSize) : undefined,
filter: rest.filter,
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 pageToken not wired through for list_spaces pagination

The pageToken parameter is defined in GoogleChatListSpacesParams and correctly forwarded to the Google API in list_spaces.ts, but it is silently dropped at the block level — it is absent from inputs, subBlocks, and the params return for the list_spaces case.

The block already outputs nextPageToken, but there is no corresponding input to feed that token back into a subsequent call, making pagination non-functional through the block.

Add pageToken to the returned params:

Suggested change
case 'list_spaces':
return {
oauthCredential,
pageSize: rest.pageSize ? Number(rest.pageSize) : undefined,
filter: rest.filter,
}
case 'list_spaces':
return {
oauthCredential,
pageSize: rest.pageSize ? Number(rest.pageSize) : undefined,
pageToken: rest.pageToken,
filter: rest.filter,
}

Also add pageToken to the inputs object:

pageToken: { type: 'string', description: 'Token for fetching the next page of results' },

And add a subBlock (in advanced mode) so users can wire a previous call's nextPageToken output into this field:

{
  id: 'pageToken',
  title: 'Page Token',
  type: 'short-input',
  placeholder: 'Token from previous list_spaces call',
  condition: { field: 'operation', value: 'list_spaces' },
  mode: 'advanced',
},

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.

1 participant