From 505fa79ca0de0966749efce2fe89ada44bf7b944 Mon Sep 17 00:00:00 2001 From: Adam Gough Date: Thu, 7 Aug 2025 12:42:39 -0700 Subject: [PATCH 1/4] changed just gmail --- apps/sim/blocks/blocks/gmail.ts | 23 +++++++++++++++++++++++ apps/sim/tools/gmail/draft.ts | 29 ++++++++++++++++++++++++----- apps/sim/tools/gmail/send.ts | 29 ++++++++++++++++++++++++----- apps/sim/tools/gmail/types.ts | 2 ++ 4 files changed, 73 insertions(+), 10 deletions(-) diff --git a/apps/sim/blocks/blocks/gmail.ts b/apps/sim/blocks/blocks/gmail.ts index c5fff27f881..436404040b3 100644 --- a/apps/sim/blocks/blocks/gmail.ts +++ b/apps/sim/blocks/blocks/gmail.ts @@ -72,6 +72,27 @@ export const GmailBlock: BlockConfig = { condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] }, required: true, }, + // Advanced Settings - Additional Recipients + { + id: 'cc', + title: 'CC', + type: 'short-input', + layout: 'full', + placeholder: 'CC recipients (comma-separated)', + condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] }, + mode: 'advanced', + required: false, + }, + { + id: 'bcc', + title: 'BCC', + type: 'short-input', + layout: 'full', + placeholder: 'BCC recipients (comma-separated)', + condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] }, + mode: 'advanced', + required: false, + }, // Label/folder selector (basic mode) { id: 'folder', @@ -198,6 +219,8 @@ export const GmailBlock: BlockConfig = { to: { type: 'string', description: 'Recipient email address' }, subject: { type: 'string', description: 'Email subject' }, body: { type: 'string', description: 'Email content' }, + cc: { type: 'string', description: 'CC recipients (comma-separated)' }, + bcc: { type: 'string', description: 'BCC recipients (comma-separated)' }, // Read operation inputs folder: { type: 'string', description: 'Gmail folder' }, manualFolder: { type: 'string', description: 'Manual folder name' }, diff --git a/apps/sim/tools/gmail/draft.ts b/apps/sim/tools/gmail/draft.ts index 3dc455e4263..5863c7bd6ee 100644 --- a/apps/sim/tools/gmail/draft.ts +++ b/apps/sim/tools/gmail/draft.ts @@ -60,6 +60,18 @@ export const gmailDraftTool: ToolConfig = { visibility: 'user-or-llm', description: 'Email body content', }, + cc: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'CC recipients (comma-separated)', + }, + bcc: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'BCC recipients (comma-separated)', + }, }, request: { @@ -70,14 +82,21 @@ export const gmailDraftTool: ToolConfig = { 'Content-Type': 'application/json', }), body: (params: GmailSendParams): Record => { - const email = [ + const emailHeaders = [ 'Content-Type: text/plain; charset="UTF-8"', 'MIME-Version: 1.0', `To: ${params.to}`, - `Subject: ${params.subject}`, - '', - params.body, - ].join('\n') + ] + + if (params.cc) { + emailHeaders.push(`Cc: ${params.cc}`) + } + if (params.bcc) { + emailHeaders.push(`Bcc: ${params.bcc}`) + } + + emailHeaders.push(`Subject: ${params.subject}`, '', params.body) + const email = emailHeaders.join('\n') return { message: { diff --git a/apps/sim/tools/gmail/send.ts b/apps/sim/tools/gmail/send.ts index 0ed09bb8868..8b3eeb31844 100644 --- a/apps/sim/tools/gmail/send.ts +++ b/apps/sim/tools/gmail/send.ts @@ -53,6 +53,18 @@ export const gmailSendTool: ToolConfig = { visibility: 'user-or-llm', description: 'Email body content', }, + cc: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'CC recipients (comma-separated)', + }, + bcc: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'BCC recipients (comma-separated)', + }, }, request: { @@ -63,14 +75,21 @@ export const gmailSendTool: ToolConfig = { 'Content-Type': 'application/json', }), body: (params: GmailSendParams): Record => { - const email = [ + const emailHeaders = [ 'Content-Type: text/plain; charset="UTF-8"', 'MIME-Version: 1.0', `To: ${params.to}`, - `Subject: ${params.subject}`, - '', - params.body, - ].join('\n') + ] + + if (params.cc) { + emailHeaders.push(`Cc: ${params.cc}`) + } + if (params.bcc) { + emailHeaders.push(`Bcc: ${params.bcc}`) + } + + emailHeaders.push(`Subject: ${params.subject}`, '', params.body) + const email = emailHeaders.join('\n') return { raw: Buffer.from(email).toString('base64url'), diff --git a/apps/sim/tools/gmail/types.ts b/apps/sim/tools/gmail/types.ts index 0b15bff0c33..4115f7ea2ec 100644 --- a/apps/sim/tools/gmail/types.ts +++ b/apps/sim/tools/gmail/types.ts @@ -8,6 +8,8 @@ interface BaseGmailParams { // Send operation parameters export interface GmailSendParams extends BaseGmailParams { to: string + cc?: string + bcc?: string subject: string body: string } From 3f9bd0cf48d8c825d68ddc27c01af05ebbbf0a43 Mon Sep 17 00:00:00 2001 From: Adam Gough Date: Thu, 7 Aug 2025 12:43:28 -0700 Subject: [PATCH 2/4] bun run lint --- apps/sim/tools/gmail/draft.ts | 4 ++-- apps/sim/tools/gmail/send.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/sim/tools/gmail/draft.ts b/apps/sim/tools/gmail/draft.ts index 5863c7bd6ee..375fe414f7f 100644 --- a/apps/sim/tools/gmail/draft.ts +++ b/apps/sim/tools/gmail/draft.ts @@ -87,14 +87,14 @@ export const gmailDraftTool: ToolConfig = { 'MIME-Version: 1.0', `To: ${params.to}`, ] - + if (params.cc) { emailHeaders.push(`Cc: ${params.cc}`) } if (params.bcc) { emailHeaders.push(`Bcc: ${params.bcc}`) } - + emailHeaders.push(`Subject: ${params.subject}`, '', params.body) const email = emailHeaders.join('\n') diff --git a/apps/sim/tools/gmail/send.ts b/apps/sim/tools/gmail/send.ts index 8b3eeb31844..8d5b3741b8d 100644 --- a/apps/sim/tools/gmail/send.ts +++ b/apps/sim/tools/gmail/send.ts @@ -80,14 +80,14 @@ export const gmailSendTool: ToolConfig = { 'MIME-Version: 1.0', `To: ${params.to}`, ] - + if (params.cc) { emailHeaders.push(`Cc: ${params.cc}`) } if (params.bcc) { emailHeaders.push(`Bcc: ${params.bcc}`) } - + emailHeaders.push(`Subject: ${params.subject}`, '', params.body) const email = emailHeaders.join('\n') From 5415b604928312947736ed9d7efd9c50b63dc047 Mon Sep 17 00:00:00 2001 From: Adam Gough Date: Thu, 7 Aug 2025 13:33:02 -0700 Subject: [PATCH 3/4] fixed bcc --- apps/sim/tools/outlook/draft.ts | 46 +++++++++++++++++++++++++++------ apps/sim/tools/outlook/types.ts | 2 ++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/apps/sim/tools/outlook/draft.ts b/apps/sim/tools/outlook/draft.ts index 7680523dd8f..9166e572839 100644 --- a/apps/sim/tools/outlook/draft.ts +++ b/apps/sim/tools/outlook/draft.ts @@ -37,6 +37,18 @@ export const outlookDraftTool: ToolConfig => { - return { + // Helper function to parse comma-separated emails + const parseEmails = (emailString?: string) => { + if (!emailString) return [] + return emailString + .split(',') + .map((email) => email.trim()) + .filter((email) => email.length > 0) + .map((email) => ({ emailAddress: { address: email } })) + } + + const message: any = { subject: params.subject, body: { contentType: 'Text', content: params.body, }, - toRecipients: [ - { - emailAddress: { - address: params.to, - }, - }, - ], + toRecipients: parseEmails(params.to), + } + + // Add CC if provided + const ccRecipients = parseEmails(params.cc) + if (ccRecipients.length > 0) { + message.ccRecipients = ccRecipients } + + // Add BCC if provided + const bccRecipients = parseEmails(params.bcc) + if (bccRecipients.length > 0) { + message.bccRecipients = bccRecipients + } + + return message }, }, transformResponse: async (response) => { diff --git a/apps/sim/tools/outlook/types.ts b/apps/sim/tools/outlook/types.ts index 02024398d0d..be0ce5456ec 100644 --- a/apps/sim/tools/outlook/types.ts +++ b/apps/sim/tools/outlook/types.ts @@ -36,6 +36,8 @@ export interface OutlookReadResponse extends ToolResponse { export interface OutlookDraftParams { accessToken: string to: string + cc?: string + bcc?: string subject: string body: string } From ce4047030eccc70735a04b95d7c54e6177aceaa6 Mon Sep 17 00:00:00 2001 From: waleedlatif1 Date: Fri, 8 Aug 2025 13:20:06 -0700 Subject: [PATCH 4/4] updated docs --- apps/docs/content/docs/tools/gmail.mdx | 10 ++++++++-- apps/docs/content/docs/tools/meta.json | 1 + apps/docs/content/docs/tools/outlook.mdx | 2 ++ apps/sim/tools/gmail/read.ts | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/docs/content/docs/tools/gmail.mdx b/apps/docs/content/docs/tools/gmail.mdx index 011b44ab990..3da6f2aaa79 100644 --- a/apps/docs/content/docs/tools/gmail.mdx +++ b/apps/docs/content/docs/tools/gmail.mdx @@ -68,6 +68,8 @@ Send emails using Gmail | `to` | string | Yes | Recipient email address | | `subject` | string | Yes | Email subject | | `body` | string | Yes | Email body content | +| `cc` | string | No | CC recipients \(comma-separated\) | +| `bcc` | string | No | BCC recipients \(comma-separated\) | #### Output @@ -87,6 +89,8 @@ Draft emails using Gmail | `to` | string | Yes | Recipient email address | | `subject` | string | Yes | Email subject | | `body` | string | Yes | Email body content | +| `cc` | string | No | CC recipients \(comma-separated\) | +| `bcc` | string | No | BCC recipients \(comma-separated\) | #### Output @@ -107,13 +111,15 @@ Read emails from Gmail | `folder` | string | No | Folder/label to read emails from | | `unreadOnly` | boolean | No | Only retrieve unread messages | | `maxResults` | number | No | Maximum number of messages to retrieve \(default: 1, max: 10\) | +| `includeAttachments` | boolean | No | Download and include email attachments | #### Output | Parameter | Type | Description | | --------- | ---- | ----------- | -| `content` | string | Email content or summary | -| `metadata` | object | Email metadata | +| `content` | string | Text content of the email | +| `metadata` | json | Metadata of the email | +| `attachments` | file[] | Attachments of the email | ### `gmail_search` diff --git a/apps/docs/content/docs/tools/meta.json b/apps/docs/content/docs/tools/meta.json index b4ba8f9277f..c954de07fd6 100644 --- a/apps/docs/content/docs/tools/meta.json +++ b/apps/docs/content/docs/tools/meta.json @@ -11,6 +11,7 @@ "exa", "file", "firecrawl", + "generic_webhook", "github", "gmail", "google_calendar", diff --git a/apps/docs/content/docs/tools/outlook.mdx b/apps/docs/content/docs/tools/outlook.mdx index 52ca800bd2c..f70725f1378 100644 --- a/apps/docs/content/docs/tools/outlook.mdx +++ b/apps/docs/content/docs/tools/outlook.mdx @@ -182,6 +182,8 @@ Draft emails using Outlook | `to` | string | Yes | Recipient email address | | `subject` | string | Yes | Email subject | | `body` | string | Yes | Email body content | +| `cc` | string | No | CC recipients \(comma-separated\) | +| `bcc` | string | No | BCC recipients \(comma-separated\) | #### Output diff --git a/apps/sim/tools/gmail/read.ts b/apps/sim/tools/gmail/read.ts index e5f29ea06d3..54e334d3fa7 100644 --- a/apps/sim/tools/gmail/read.ts +++ b/apps/sim/tools/gmail/read.ts @@ -24,9 +24,9 @@ export const gmailReadTool: ToolConfig = { }, outputs: { - content: { type: 'string' }, - metadata: { type: 'json' }, - attachments: { type: 'file[]' }, + content: { type: 'string', description: 'Text content of the email' }, + metadata: { type: 'json', description: 'Metadata of the email' }, + attachments: { type: 'file[]', description: 'Attachments of the email' }, }, params: {