Skip to content

Commit 7f39cd0

Browse files
aadamgoughAdam Goughwaleedlatif1
authored
Improvement(cc): added cc to gmail and outlook (#900)
* changed just gmail * bun run lint * fixed bcc * updated docs --------- Co-authored-by: Adam Gough <[email protected]> Co-authored-by: waleedlatif1 <[email protected]>
1 parent 658942d commit 7f39cd0

File tree

10 files changed

+127
-23
lines changed

10 files changed

+127
-23
lines changed

apps/docs/content/docs/tools/gmail.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Send emails using Gmail
6868
| `to` | string | Yes | Recipient email address |
6969
| `subject` | string | Yes | Email subject |
7070
| `body` | string | Yes | Email body content |
71+
| `cc` | string | No | CC recipients \(comma-separated\) |
72+
| `bcc` | string | No | BCC recipients \(comma-separated\) |
7173

7274
#### Output
7375

@@ -87,6 +89,8 @@ Draft emails using Gmail
8789
| `to` | string | Yes | Recipient email address |
8890
| `subject` | string | Yes | Email subject |
8991
| `body` | string | Yes | Email body content |
92+
| `cc` | string | No | CC recipients \(comma-separated\) |
93+
| `bcc` | string | No | BCC recipients \(comma-separated\) |
9094

9195
#### Output
9296

@@ -107,13 +111,15 @@ Read emails from Gmail
107111
| `folder` | string | No | Folder/label to read emails from |
108112
| `unreadOnly` | boolean | No | Only retrieve unread messages |
109113
| `maxResults` | number | No | Maximum number of messages to retrieve \(default: 1, max: 10\) |
114+
| `includeAttachments` | boolean | No | Download and include email attachments |
110115

111116
#### Output
112117

113118
| Parameter | Type | Description |
114119
| --------- | ---- | ----------- |
115-
| `content` | string | Email content or summary |
116-
| `metadata` | object | Email metadata |
120+
| `content` | string | Text content of the email |
121+
| `metadata` | json | Metadata of the email |
122+
| `attachments` | file[] | Attachments of the email |
117123

118124
### `gmail_search`
119125

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"exa",
1212
"file",
1313
"firecrawl",
14+
"generic_webhook",
1415
"github",
1516
"gmail",
1617
"google_calendar",

apps/docs/content/docs/tools/outlook.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ Draft emails using Outlook
182182
| `to` | string | Yes | Recipient email address |
183183
| `subject` | string | Yes | Email subject |
184184
| `body` | string | Yes | Email body content |
185+
| `cc` | string | No | CC recipients \(comma-separated\) |
186+
| `bcc` | string | No | BCC recipients \(comma-separated\) |
185187

186188
#### Output
187189

apps/sim/blocks/blocks/gmail.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
7272
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
7373
required: true,
7474
},
75+
// Advanced Settings - Additional Recipients
76+
{
77+
id: 'cc',
78+
title: 'CC',
79+
type: 'short-input',
80+
layout: 'full',
81+
placeholder: 'CC recipients (comma-separated)',
82+
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
83+
mode: 'advanced',
84+
required: false,
85+
},
86+
{
87+
id: 'bcc',
88+
title: 'BCC',
89+
type: 'short-input',
90+
layout: 'full',
91+
placeholder: 'BCC recipients (comma-separated)',
92+
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
93+
mode: 'advanced',
94+
required: false,
95+
},
7596
// Label/folder selector (basic mode)
7697
{
7798
id: 'folder',
@@ -198,6 +219,8 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
198219
to: { type: 'string', description: 'Recipient email address' },
199220
subject: { type: 'string', description: 'Email subject' },
200221
body: { type: 'string', description: 'Email content' },
222+
cc: { type: 'string', description: 'CC recipients (comma-separated)' },
223+
bcc: { type: 'string', description: 'BCC recipients (comma-separated)' },
201224
// Read operation inputs
202225
folder: { type: 'string', description: 'Gmail folder' },
203226
manualFolder: { type: 'string', description: 'Manual folder name' },

apps/sim/tools/gmail/draft.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ export const gmailDraftTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
6060
visibility: 'user-or-llm',
6161
description: 'Email body content',
6262
},
63+
cc: {
64+
type: 'string',
65+
required: false,
66+
visibility: 'user-or-llm',
67+
description: 'CC recipients (comma-separated)',
68+
},
69+
bcc: {
70+
type: 'string',
71+
required: false,
72+
visibility: 'user-or-llm',
73+
description: 'BCC recipients (comma-separated)',
74+
},
6375
},
6476

6577
request: {
@@ -70,14 +82,21 @@ export const gmailDraftTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
7082
'Content-Type': 'application/json',
7183
}),
7284
body: (params: GmailSendParams): Record<string, any> => {
73-
const email = [
85+
const emailHeaders = [
7486
'Content-Type: text/plain; charset="UTF-8"',
7587
'MIME-Version: 1.0',
7688
`To: ${params.to}`,
77-
`Subject: ${params.subject}`,
78-
'',
79-
params.body,
80-
].join('\n')
89+
]
90+
91+
if (params.cc) {
92+
emailHeaders.push(`Cc: ${params.cc}`)
93+
}
94+
if (params.bcc) {
95+
emailHeaders.push(`Bcc: ${params.bcc}`)
96+
}
97+
98+
emailHeaders.push(`Subject: ${params.subject}`, '', params.body)
99+
const email = emailHeaders.join('\n')
81100

82101
return {
83102
message: {

apps/sim/tools/gmail/read.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const gmailReadTool: ToolConfig<GmailReadParams, GmailToolResponse> = {
2424
},
2525

2626
outputs: {
27-
content: { type: 'string' },
28-
metadata: { type: 'json' },
29-
attachments: { type: 'file[]' },
27+
content: { type: 'string', description: 'Text content of the email' },
28+
metadata: { type: 'json', description: 'Metadata of the email' },
29+
attachments: { type: 'file[]', description: 'Attachments of the email' },
3030
},
3131

3232
params: {

apps/sim/tools/gmail/send.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ export const gmailSendTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
5353
visibility: 'user-or-llm',
5454
description: 'Email body content',
5555
},
56+
cc: {
57+
type: 'string',
58+
required: false,
59+
visibility: 'user-or-llm',
60+
description: 'CC recipients (comma-separated)',
61+
},
62+
bcc: {
63+
type: 'string',
64+
required: false,
65+
visibility: 'user-or-llm',
66+
description: 'BCC recipients (comma-separated)',
67+
},
5668
},
5769

5870
request: {
@@ -63,14 +75,21 @@ export const gmailSendTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
6375
'Content-Type': 'application/json',
6476
}),
6577
body: (params: GmailSendParams): Record<string, any> => {
66-
const email = [
78+
const emailHeaders = [
6779
'Content-Type: text/plain; charset="UTF-8"',
6880
'MIME-Version: 1.0',
6981
`To: ${params.to}`,
70-
`Subject: ${params.subject}`,
71-
'',
72-
params.body,
73-
].join('\n')
82+
]
83+
84+
if (params.cc) {
85+
emailHeaders.push(`Cc: ${params.cc}`)
86+
}
87+
if (params.bcc) {
88+
emailHeaders.push(`Bcc: ${params.bcc}`)
89+
}
90+
91+
emailHeaders.push(`Subject: ${params.subject}`, '', params.body)
92+
const email = emailHeaders.join('\n')
7493

7594
return {
7695
raw: Buffer.from(email).toString('base64url'),

apps/sim/tools/gmail/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ interface BaseGmailParams {
88
// Send operation parameters
99
export interface GmailSendParams extends BaseGmailParams {
1010
to: string
11+
cc?: string
12+
bcc?: string
1113
subject: string
1214
body: string
1315
}

apps/sim/tools/outlook/draft.ts

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ export const outlookDraftTool: ToolConfig<OutlookDraftParams, OutlookDraftRespon
3737
visibility: 'user-or-llm',
3838
description: 'Email body content',
3939
},
40+
cc: {
41+
type: 'string',
42+
required: false,
43+
visibility: 'user-or-llm',
44+
description: 'CC recipients (comma-separated)',
45+
},
46+
bcc: {
47+
type: 'string',
48+
required: false,
49+
visibility: 'user-or-llm',
50+
description: 'BCC recipients (comma-separated)',
51+
},
4052
},
4153

4254
outputs: {
@@ -65,20 +77,38 @@ export const outlookDraftTool: ToolConfig<OutlookDraftParams, OutlookDraftRespon
6577
}
6678
},
6779
body: (params: OutlookDraftParams): Record<string, any> => {
68-
return {
80+
// Helper function to parse comma-separated emails
81+
const parseEmails = (emailString?: string) => {
82+
if (!emailString) return []
83+
return emailString
84+
.split(',')
85+
.map((email) => email.trim())
86+
.filter((email) => email.length > 0)
87+
.map((email) => ({ emailAddress: { address: email } }))
88+
}
89+
90+
const message: any = {
6991
subject: params.subject,
7092
body: {
7193
contentType: 'Text',
7294
content: params.body,
7395
},
74-
toRecipients: [
75-
{
76-
emailAddress: {
77-
address: params.to,
78-
},
79-
},
80-
],
96+
toRecipients: parseEmails(params.to),
97+
}
98+
99+
// Add CC if provided
100+
const ccRecipients = parseEmails(params.cc)
101+
if (ccRecipients.length > 0) {
102+
message.ccRecipients = ccRecipients
81103
}
104+
105+
// Add BCC if provided
106+
const bccRecipients = parseEmails(params.bcc)
107+
if (bccRecipients.length > 0) {
108+
message.bccRecipients = bccRecipients
109+
}
110+
111+
return message
82112
},
83113
},
84114
transformResponse: async (response) => {

apps/sim/tools/outlook/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export interface OutlookReadResponse extends ToolResponse {
3636
export interface OutlookDraftParams {
3737
accessToken: string
3838
to: string
39+
cc?: string
40+
bcc?: string
3941
subject: string
4042
body: string
4143
}

0 commit comments

Comments
 (0)