Skip to content

feat(attachments): use filesystem for gmail, outlook triggers to save attachments - #1631

Merged
icecrasher321 merged 10 commits into
stagingfrom
feat/add-attachments-triggers
Oct 15, 2025
Merged

feat(attachments): use filesystem for gmail, outlook triggers to save attachments#1631
icecrasher321 merged 10 commits into
stagingfrom
feat/add-attachments-triggers

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

  • Fix subblock subscription
  • Add include attachments for Gmail Trigger, Outlook Block+Trigger

Type of Change

  • Bug fix
  • 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

vercelBot commented Oct 15, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedOct 15, 2025 2:06am

@greptile-appsgreptile-appsBot left a comment

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.

Greptile Overview

Summary

Adds filesystem-based attachment handling for Gmail and Outlook triggers/blocks. Attachments are downloaded from email APIs and uploaded to execution storage using a new WebhookAttachmentProcessor utility class.

Key changes:

  • New WebhookAttachmentProcessor class handles attachment upload to execution storage
  • Gmail and Outlook triggers now support includeAttachments configuration option
  • Gmail and Outlook blocks (read operations) support includeAttachments parameter
  • Attachments are converted to UserFile objects for workflow consumption
  • Deploy API no longer auto-generates API keys - requires user to provide one
  • Fixed subblock subscription bug in workflow-block.tsx

Critical Issue:
The polling services create temporary execution IDs when storing attachments, which may prevent workflow executions from accessing these attachments since the execution ID won't match.

Confidence Score: 2/5

  • This PR has a critical logic issue with temporary execution IDs that will likely prevent attachments from being accessible
  • The temporary executionId created during polling (line 564 in gmail-polling-service.ts and line 379 in outlook-polling-service.ts) won't match the actual workflow execution ID, breaking the attachment access flow. Additionally, the deploy route changes removing API key auto-generation could be a breaking change for existing users.
  • Pay close attention to apps/sim/lib/webhooks/gmail-polling-service.ts and apps/sim/lib/webhooks/outlook-polling-service.ts - the temporary executionId logic needs to be addressed

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/lib/webhooks/attachment-processor.ts5/5New utility class for processing webhook attachments, uploading them to execution storage, with proper error handling
apps/sim/lib/webhooks/gmail-polling-service.ts4/5Added attachment download and processing for Gmail triggers using new attachment processor
apps/sim/lib/webhooks/outlook-polling-service.ts4/5Added attachment download and processing for Outlook triggers with new downloadOutlookAttachments function
apps/sim/app/api/workflows/[id]/deploy/route.ts3/5Removed auto-generation of API keys, now requires user to provide one - potential breaking change

Sequence Diagram

sequenceDiagram
participant User
participant Trigger as Gmail/Outlook Trigger
participant PollingService as Polling Service
participant EmailAPI as Email API (Gmail/Outlook)
participant AttachmentProcessor as WebhookAttachmentProcessor
participant Storage as Execution File Storage
participant Workflow as Workflow Execution
User->>Trigger: Configure includeAttachments=true
Trigger->>PollingService: Poll for new emails
PollingService->>EmailAPI: Fetch new emails
EmailAPI-->>PollingService: Return email list
alt includeAttachments enabled
PollingService->>EmailAPI: Download attachments
EmailAPI-->>PollingService: Return attachment data (Buffer)
PollingService->>PollingService: Create temporary executionId
PollingService->>AttachmentProcessor: processAttachments()
AttachmentProcessor->>Storage: uploadExecutionFile()
Storage-->>AttachmentProcessor: Return UserFile objects
AttachmentProcessor-->>PollingService: Return processed attachments
end
PollingService->>Workflow: Trigger workflow with email + attachments
Workflow->>Storage: Access attachment files via UserFile URLs
Storage-->>Workflow: Serve attachment data
Loading

11 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment threadapps/sim/lib/webhooks/gmail-polling-service.ts Outdated
Comment threadapps/sim/lib/webhooks/outlook-polling-service.ts Outdated
@icecrasher321
icecrasher321 merged commit b296323 into stagingOct 15, 2025
9 checks passed
Sg312 pushed a commit that referenced this pull request Oct 15, 2025
… attachments (#1631)
* feat(outlook): add include attachment feature to outlook
* add include attachments to gmail trigger
* add gmail trigger, outlook block include attachments
* fix rendering issue
* remove comment
* fix architecture
* fix redeploy
* pass files to logging session to surface in logs
* fix gmail block parsing attachments
* fix reads
@waleedlatif1
waleedlatif1 deleted the feat/add-attachments-triggers branch November 7, 2025 20:19
Sign up for freeto 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

@icecrasher321