Skip to content

Commit 9c6d9b3

Browse files
committed
feat(google-chat): add Google Chat integration with OAuth
1 parent 67f8a68 commit 9c6d9b3

File tree

15 files changed

+533
-7
lines changed

15 files changed

+533
-7
lines changed

apps/docs/components/icons.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,42 @@ export function GoogleCalendarIcon(props: SVGProps<SVGSVGElement>) {
13021302
)
13031303
}
13041304

1305+
export function GoogleChatIcon(props: SVGProps<SVGSVGElement>) {
1306+
return (
1307+
<svg
1308+
{...props}
1309+
viewBox="0 0 311 320"
1310+
fill="none"
1311+
xmlns="http://www.w3.org/2000/svg"
1312+
>
1313+
<path
1314+
fill="#0066da"
1315+
d="M76.37 0.51L76.38 76.98L0 76.96L0 20.77Q0.85 14.81 3.53 10.76Q10.14 0.74 22.75 0.67Q49.41 0.53 76.37 0.51Z"
1316+
/>
1317+
<path
1318+
fill="#fbbc04"
1319+
d="M76.37 0.51L233.79 0.53A1.61 1.57-26.7 0 1 234.71 0.82L235.08 1.09Q234.92 1.15 234.81 1.22Q234.64 1.31 234.64 1.5L234.62 77.01Q234.6 77.01 234.57 77.01L76.41 77.01Q76.4 77 76.38 76.98L76.37 0.51Z"
1320+
/>
1321+
<path
1322+
fill="#ea4335"
1323+
d="M235.08 1.09L310.53 76.77L234.62 77.01L234.64 1.5Q234.64 1.31 234.81 1.22Q234.92 1.15 235.08 1.09Z"
1324+
/>
1325+
<path
1326+
fill="#2684fc"
1327+
d="M0 76.96L76.38 76.98Q76.4 77 76.41 77.01L76.43 182.69L0 182.67L0 76.96Z"
1328+
/>
1329+
<path
1330+
fill="#00ac47"
1331+
d="M310.53 76.77L311 77.11L311 239.01Q308.34 253.54 295.94 257.78Q291.52 259.3 282.91 259.28Q227.02 259.19 169.99 259.11Q161.71 259.1 153.19 259.23Q152.72 259.24 152.39 259.57Q124.49 287.34 96.39 315.59C93.52 318.48 90.27 320.09 86.15 319.48Q80.39 318.63 77.66 313.54Q76.51 311.38 76.49 305.66Q76.42 282.47 76.44 259.13L76.43 220.85L114.21 183.07A1.79 1.77 22.3 0 1 115.47 182.55L233.77 182.59A0.83 0.83 0 0 0 234.6 181.76L234.57 77.01Q234.6 77.01 234.62 77.01L310.53 76.77Z"
1332+
/>
1333+
<path
1334+
fill="#00832d"
1335+
d="M76.43 182.69L76.43 220.85L76.44 259.13Q52.47 259.27 28.91 259.22Q19.09 259.2 14.76 257.68Q2.62 253.44 0 238.88L0 182.67L76.43 182.69Z"
1336+
/>
1337+
</svg>
1338+
)
1339+
}
1340+
13051341
export function SupabaseIcon(props: SVGProps<SVGSVGElement>) {
13061342
const id = useId()
13071343
const gradient0 = `supabase_paint0_${id}`

apps/docs/components/ui/icon-mapping.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ import {
3838
EyeIcon,
3939
FirecrawlIcon,
4040
FirefliesIcon,
41-
GithubIcon,
4241
GitLabIcon,
42+
GithubIcon,
4343
GmailIcon,
4444
GongIcon,
4545
GoogleBooksIcon,
4646
GoogleCalendarIcon,
47+
GoogleChatIcon,
4748
GoogleDocsIcon,
4849
GoogleDriveIcon,
4950
GoogleFormsIcon,
@@ -72,9 +73,9 @@ import {
7273
LinearIcon,
7374
LinkedInIcon,
7475
LinkupIcon,
76+
MailServerIcon,
7577
MailchimpIcon,
7678
MailgunIcon,
77-
MailServerIcon,
7879
Mem0Icon,
7980
MicrosoftDataverseIcon,
8081
MicrosoftExcelIcon,
@@ -107,6 +108,8 @@ import {
107108
ResendIcon,
108109
RevenueCatIcon,
109110
S3Icon,
111+
SQSIcon,
112+
STTIcon,
110113
SalesforceIcon,
111114
SearchIcon,
112115
SendgridIcon,
@@ -118,19 +121,17 @@ import {
118121
SimilarwebIcon,
119122
SlackIcon,
120123
SmtpIcon,
121-
SQSIcon,
122124
SshIcon,
123-
STTIcon,
124125
StagehandIcon,
125126
StripeIcon,
126127
SupabaseIcon,
128+
TTSIcon,
127129
TavilyIcon,
128130
TelegramIcon,
129131
TextractIcon,
130132
TinybirdIcon,
131133
TranslateIcon,
132134
TrelloIcon,
133-
TTSIcon,
134135
TwilioIcon,
135136
TypeformIcon,
136137
UpstashIcon,
@@ -141,11 +142,11 @@ import {
141142
WhatsAppIcon,
142143
WikipediaIcon,
143144
WordpressIcon,
144-
xIcon,
145145
YouTubeIcon,
146146
ZendeskIcon,
147147
ZepIcon,
148148
ZoomIcon,
149+
xIcon,
149150
} from '@/components/icons'
150151

151152
type IconComponent = ComponentType<SVGProps<SVGSVGElement>>
@@ -189,6 +190,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
189190
gong: GongIcon,
190191
google_books: GoogleBooksIcon,
191192
google_calendar_v2: GoogleCalendarIcon,
193+
google_chat: GoogleChatIcon,
192194
google_docs: GoogleDocsIcon,
193195
google_drive: GoogleDriveIcon,
194196
google_forms: GoogleFormsIcon,
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Google Chat
3+
description: Send messages and manage Google Chat spaces
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="google_chat"
10+
color="#E0E0E0"
11+
/>
12+
13+
## Usage Instructions
14+
15+
Integrate with Google Chat to send messages to spaces and list available spaces using OAuth.
16+
17+
18+
19+
## Tools
20+
21+
### `google_chat_send_message`
22+
23+
Send a message to a Google Chat space
24+
25+
#### Input
26+
27+
| Parameter | Type | Required | Description |
28+
| --------- | ---- | -------- | ----------- |
29+
| `spaceId` | string | Yes | The Google Chat space ID \(e.g., spaces/AAAA1234\) |
30+
| `message` | string | Yes | Message text to send |
31+
| `threadKey` | string | No | Thread key for sending a threaded reply |
32+
33+
#### Output
34+
35+
| Parameter | Type | Description |
36+
| --------- | ---- | ----------- |
37+
| `messageName` | string | Google Chat message resource name |
38+
| `spaceName` | string | Space the message was sent to |
39+
| `threadName` | string | Thread resource name |
40+
| `text` | string | Message text that was sent |
41+
| `createTime` | string | Timestamp when the message was created |
42+
43+
### `google_chat_list_spaces`
44+
45+
List Google Chat spaces the user is a member of
46+
47+
#### Input
48+
49+
| Parameter | Type | Required | Description |
50+
| --------- | ---- | -------- | ----------- |
51+
| `pageSize` | number | No | Maximum number of spaces to return \(default 100, max 1000\) |
52+
| `pageToken` | string | No | Token for fetching the next page of results |
53+
| `filter` | string | No | Filter by space type \(e.g., spaceType = "SPACE", spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"\) |
54+
55+
#### Output
56+
57+
| Parameter | Type | Description |
58+
| --------- | ---- | ----------- |
59+
| `spaces` | json | Array of Google Chat space objects |
60+
| `nextPageToken` | string | Token for fetching the next page of results |
61+
62+

apps/docs/content/docs/en/tools/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"gong",
4040
"google_books",
4141
"google_calendar",
42+
"google_chat",
4243
"google_docs",
4344
"google_drive",
4445
"google_forms",
@@ -146,4 +147,4 @@
146147
"zep",
147148
"zoom"
148149
]
149-
}
150+
}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ const SCOPE_DESCRIPTIONS: Record<string, string> = {
5252
'https://www.googleapis.com/auth/admin.directory.group.readonly': 'View Google Workspace groups',
5353
'https://www.googleapis.com/auth/admin.directory.group.member.readonly':
5454
'View Google Workspace group memberships',
55+
'https://www.googleapis.com/auth/chat.spaces.readonly': 'View Google Chat spaces',
56+
'https://www.googleapis.com/auth/chat.messages.create': 'Send messages in Google Chat',
5557
'https://www.googleapis.com/auth/cloud-platform':
5658
'Full access to Google Cloud resources for Vertex AI',
5759
'read:confluence-content.all': 'Read all Confluence content',
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import { GoogleChatIcon } from '@/components/icons'
2+
import type { BlockConfig } from '@/blocks/types'
3+
import { AuthMode } from '@/blocks/types'
4+
import type { GoogleChatResponse } from '@/tools/google_chat/types'
5+
6+
export const GoogleChatBlock: BlockConfig<GoogleChatResponse> = {
7+
type: 'google_chat',
8+
name: 'Google Chat',
9+
description: 'Send messages and manage Google Chat spaces',
10+
authMode: AuthMode.OAuth,
11+
longDescription:
12+
'Integrate with Google Chat to send messages to spaces and list available spaces using OAuth.',
13+
docsLink: 'https://docs.sim.ai/tools/google-chat',
14+
category: 'tools',
15+
bgColor: '#E0E0E0',
16+
icon: GoogleChatIcon,
17+
subBlocks: [
18+
{
19+
id: 'operation',
20+
title: 'Operation',
21+
type: 'dropdown',
22+
options: [
23+
{ label: 'Send Message', id: 'send_message' },
24+
{ label: 'List Spaces', id: 'list_spaces' },
25+
],
26+
value: () => 'send_message',
27+
},
28+
{
29+
id: 'credential',
30+
title: 'Google Chat Account',
31+
type: 'oauth-input',
32+
canonicalParamId: 'oauthCredential',
33+
mode: 'basic',
34+
required: true,
35+
serviceId: 'google-chat',
36+
requiredScopes: [
37+
'https://www.googleapis.com/auth/chat.spaces.readonly',
38+
'https://www.googleapis.com/auth/chat.messages.create',
39+
],
40+
placeholder: 'Select Google account',
41+
},
42+
{
43+
id: 'manualCredential',
44+
title: 'Google Chat Account',
45+
type: 'short-input',
46+
canonicalParamId: 'oauthCredential',
47+
mode: 'advanced',
48+
placeholder: 'Enter credential ID',
49+
required: true,
50+
},
51+
{
52+
id: 'spaceId',
53+
title: 'Space ID',
54+
type: 'short-input',
55+
placeholder: 'e.g., spaces/AAAA1234 or AAAA1234',
56+
required: { field: 'operation', value: 'send_message' },
57+
condition: { field: 'operation', value: 'send_message' },
58+
},
59+
{
60+
id: 'message',
61+
title: 'Message',
62+
type: 'long-input',
63+
placeholder: 'Enter your message',
64+
required: { field: 'operation', value: 'send_message' },
65+
condition: { field: 'operation', value: 'send_message' },
66+
},
67+
{
68+
id: 'threadKey',
69+
title: 'Thread Key',
70+
type: 'short-input',
71+
placeholder: 'Optional thread key for threaded replies',
72+
condition: { field: 'operation', value: 'send_message' },
73+
},
74+
{
75+
id: 'filter',
76+
title: 'Filter',
77+
type: 'short-input',
78+
placeholder: 'e.g., spaceType = "SPACE"',
79+
condition: { field: 'operation', value: 'list_spaces' },
80+
},
81+
{
82+
id: 'pageSize',
83+
title: 'Max Results',
84+
type: 'short-input',
85+
placeholder: 'Maximum spaces to return (default 100)',
86+
condition: { field: 'operation', value: 'list_spaces' },
87+
},
88+
],
89+
tools: {
90+
access: ['google_chat_send_message', 'google_chat_list_spaces'],
91+
config: {
92+
tool: (params) => {
93+
switch (params.operation) {
94+
case 'send_message':
95+
return 'google_chat_send_message'
96+
case 'list_spaces':
97+
return 'google_chat_list_spaces'
98+
default:
99+
throw new Error(`Invalid Google Chat operation: ${params.operation}`)
100+
}
101+
},
102+
params: (params) => {
103+
const { oauthCredential, operation, ...rest } = params
104+
105+
switch (operation) {
106+
case 'send_message':
107+
return {
108+
oauthCredential,
109+
spaceId: rest.spaceId,
110+
message: rest.message,
111+
threadKey: rest.threadKey,
112+
}
113+
case 'list_spaces':
114+
return {
115+
oauthCredential,
116+
pageSize: rest.pageSize ? Number(rest.pageSize) : undefined,
117+
filter: rest.filter,
118+
}
119+
default:
120+
return { oauthCredential, ...rest }
121+
}
122+
},
123+
},
124+
},
125+
inputs: {
126+
operation: { type: 'string', description: 'Operation to perform' },
127+
oauthCredential: { type: 'string', description: 'Google Chat OAuth credential' },
128+
spaceId: { type: 'string', description: 'Google Chat space ID' },
129+
message: { type: 'string', description: 'Message text to send' },
130+
threadKey: { type: 'string', description: 'Thread key for threaded replies' },
131+
filter: { type: 'string', description: 'Filter by space type' },
132+
pageSize: { type: 'number', description: 'Maximum number of spaces to return' },
133+
},
134+
outputs: {
135+
messageName: { type: 'string', description: 'Message resource name' },
136+
spaceName: { type: 'string', description: 'Space resource name' },
137+
threadName: { type: 'string', description: 'Thread resource name' },
138+
text: { type: 'string', description: 'Message text that was sent' },
139+
createTime: { type: 'string', description: 'Message creation timestamp' },
140+
spaces: { type: 'json', description: 'Array of Google Chat space objects' },
141+
nextPageToken: { type: 'string', description: 'Token for next page of results' },
142+
},
143+
}

apps/sim/blocks/registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { GongBlock } from '@/blocks/blocks/gong'
4545
import { GoogleSearchBlock } from '@/blocks/blocks/google'
4646
import { GoogleBooksBlock } from '@/blocks/blocks/google_books'
4747
import { GoogleCalendarBlock, GoogleCalendarV2Block } from '@/blocks/blocks/google_calendar'
48+
import { GoogleChatBlock } from '@/blocks/blocks/google_chat'
4849
import { GoogleDocsBlock } from '@/blocks/blocks/google_docs'
4950
import { GoogleDriveBlock } from '@/blocks/blocks/google_drive'
5051
import { GoogleFormsBlock } from '@/blocks/blocks/google_forms'
@@ -227,6 +228,7 @@ export const registry: Record<string, BlockConfig> = {
227228
gmail: GmailBlock,
228229
gmail_v2: GmailV2Block,
229230
google_calendar: GoogleCalendarBlock,
231+
google_chat: GoogleChatBlock,
230232
google_calendar_v2: GoogleCalendarV2Block,
231233
google_books: GoogleBooksBlock,
232234
google_docs: GoogleDocsBlock,

0 commit comments

Comments
 (0)