Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Will do webhook lifecycle management as part of deploy process.

Type of Change

  • Other: UX Improvement

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
Copy link

vercel bot commented Jan 15, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 15, 2026 8:37pm

Review with Vercel Agent

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 15, 2026

Greptile Summary

  • Refactors webhook lifecycle management from manual "Save Configuration" button to automated webhook creation during workflow deployment process
  • Removes deprecated TriggerSave component and related UI elements throughout the codebase while integrating webhook operations into the deploy route
  • Consolidates provider-specific webhook subscription logic into a centralized module with comprehensive error handling and cleanup

Important Files Changed

Filename Overview
apps/sim/lib/webhooks/deploy.ts New file implementing comprehensive webhook lifecycle management during deployment with validation, cleanup, and external provider integration
apps/sim/app/api/workflows/[id]/deploy/route.ts Integrates automated webhook creation into deployment flow; critical for ensuring webhooks are properly configured before workflow activation
apps/sim/lib/webhooks/provider-subscriptions.ts Consolidates all provider-specific webhook subscription functions with standardized error handling and authentication patterns
apps/sim/app/api/workflows/[id]/state/route.ts Removes 200+ lines of webhook synchronization logic that previously handled webhooks during state saves
apps/sim/app/api/webhooks/[id]/route.ts Complex provider configuration merging logic for webhook updates; potential issues with config handling during updates

Confidence score: 4/5

  • This PR significantly improves user experience by eliminating manual webhook configuration steps and centralizing management
  • Score reflects complexity of webhook lifecycle changes and potential edge cases with provider configuration merging in PATCH route
  • Pay close attention to apps/sim/lib/webhooks/deploy.ts and webhook configuration merging logic in the PATCH route

Sequence Diagram

sequenceDiagram
    participant User
    participant "Deploy API" as Deploy
    participant "Webhook Deploy" as WH
    participant "Provider Subscriptions" as PS
    participant "Webhook Utils" as WU
    participant Database as DB
    participant "External Provider" as EP

    User->>Deploy: "POST /api/workflows/{id}/deploy"
    Deploy->>WH: "saveTriggerWebhooksForDeploy"
    
    WH->>DB: "Query existing webhooks"
    WH->>WH: "Determine webhooks to delete/create"
    
    alt Webhooks to delete
        WH->>PS: "cleanupExternalWebhook"
        PS->>EP: "Delete webhook subscription"
        WH->>DB: "Delete webhook records"
    end
    
    alt Credential Set webhooks
        WH->>WU: "syncWebhooksForCredentialSet"
        WU->>DB: "Create multiple webhooks"
        WU->>PS: "createExternalWebhookSubscription"
        PS->>EP: "Create external subscription"
    end
    
    alt Regular webhooks
        WH->>PS: "createExternalWebhookSubscription"
        PS->>EP: "Create external subscription"
        PS-->>WH: "Updated config with external ID"
        WH->>DB: "Insert webhook record"
    end
    
    alt Polling webhooks
        WH->>WU: "configureGmailPolling/configureOutlookPolling"
        WU->>EP: "Configure polling service"
    end
    
    WH-->>Deploy: "Success/Error result"
    Deploy-->>User: "Deployment response"
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

18 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit e499cc4 into staging Jan 15, 2026
10 checks passed
Sign up for free to 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.

2 participants