feat(google-chat): add Google Chat integration with OAuth#3339
feat(google-chat): add Google Chat integration with OAuth#3339waleedlatif1 wants to merge 7 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis 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
Confidence Score: 4/5Safe 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
Sequence DiagramsequenceDiagram
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)
Reviews (3): Last reviewed commit: "lint" | Re-trigger Greptile |
55d2b09 to
5cccde3
Compare
|
@cursor review |
|
@greptile |
There was a problem hiding this comment.
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.
…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
| case 'list_spaces': | ||
| return { | ||
| oauthCredential, | ||
| pageSize: rest.pageSize ? Number(rest.pageSize) : undefined, | ||
| filter: rest.filter, | ||
| } |
There was a problem hiding this comment.
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:
| 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',
},
Summary
google-chatOAuth provider under Google withchat.spaces.readonlyandchat.messages.createscopesType of Change
Testing
Tested manually
Checklist