Skip to content

feat(triggers): add Salesforce webhook triggers#3982

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/salesforce-trigger
Apr 6, 2026
Merged

feat(triggers): add Salesforce webhook triggers#3982
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/salesforce-trigger

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add 6 Salesforce webhook triggers: record created/updated/deleted, opportunity stage changed, case status changed, and generic webhook
  • Register triggers in registry and wire into Salesforce block
  • Manual webhook setup via Salesforce Flow HTTP Callouts (Salesforce has no programmatic webhook API)

Type of Change

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

vercel bot commented Apr 6, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 6, 2026 5:45pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 6, 2026

PR Summary

Medium Risk
Adds new webhook trigger configurations and wires them into the Salesforce block/trigger registry; risk is mainly around correct trigger selection/output shape and webhook payload handling for new endpoints.

Overview
Adds six new Salesforce webhook-based triggers (record created/updated/deleted, opportunity stage changed, case status changed, and a generic “all events” webhook) with standardized sub-block UI, setup instructions, and declared outputs.

Registers these triggers in TRIGGER_REGISTRY and updates the SalesforceBlock to enable triggers, advertise the available trigger IDs, and merge the trigger-specific subBlocks via getTrigger(...) so they appear in the block configuration UI.

Reviewed by Cursor Bugbot for commit d67ab32. Configure here.

@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Apr 6, 2026

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 6, 2026

Greptile Summary

This PR adds 6 Salesforce webhook triggers (record created/updated/deleted, opportunity stage changed, case status changed, and a generic catch-all) following the established pattern used by Lemlist, Cal.com, and Confluence integrations. The code is well-structured with shared utilities in utils.ts, correctly registered in the trigger registry, and properly wired into the Salesforce block config.

Two P2 UX issues were found in utils.ts:

  • The setup instruction step 3 for "Opportunity Stage Changed" and "Case Status Changed" references trigger condition names that don't exist in Salesforce Flow UI, which will confuse users during manual setup.
  • The changedFields output is included in buildSalesforceRecordOutputs() which is shared across created, updated, and deleted triggers — but changedFields is only meaningful for update events, and seeing it as an available output on created/deleted triggers will mislead workflow authors.

Confidence Score: 5/5

Safe to merge — functionally correct code that follows established patterns; only P2 UX/documentation issues remain

Both findings are P2 issues in setup instruction text and output schema semantics that do not affect runtime behavior or data integrity. All 6 triggers are correctly registered, the block wiring is correct, and the code structure mirrors proven existing integrations.

apps/sim/triggers/salesforce/utils.ts — incorrect Flow trigger condition names for Opportunity Stage Changed and Case Status Changed, and changedFields on created/deleted outputs

Important Files Changed

Filename Overview
apps/sim/triggers/salesforce/utils.ts Core utility file with two P2 issues: incorrect Salesforce Flow trigger condition names for Opportunity Stage Changed and Case Status Changed, and changedFields output unnecessarily included on created/deleted trigger outputs
apps/sim/triggers/salesforce/record_created.ts Well-structured primary trigger with includeDropdown, correct extraFields for object type filtering; should use base outputs variant without changedFields
apps/sim/triggers/salesforce/record_updated.ts Correct secondary trigger following established pattern; changedFields is semantically appropriate here
apps/sim/triggers/salesforce/record_deleted.ts Correct structure with extraFields for object type filtering; should use base outputs variant without changedFields
apps/sim/triggers/salesforce/opportunity_stage_changed.ts Setup instructions (via utils) reference a non-existent Salesforce Flow trigger condition 'Opportunity Stage Changed'
apps/sim/triggers/salesforce/case_status_changed.ts Setup instructions (via utils) reference a non-existent Salesforce Flow trigger condition 'Case Status Changed'
apps/sim/triggers/salesforce/webhook.ts Correctly uses the generic instruction path (isGeneric branch) with clear multi-object guidance
apps/sim/triggers/salesforce/index.ts Standard barrel export following the established pattern of other trigger integrations (lemlist, calcom)
apps/sim/triggers/registry.ts All 6 Salesforce triggers correctly registered alphabetically between rss_poller and stripe_webhook
apps/sim/blocks/blocks/salesforce.ts Triggers object and subBlock spreads correctly wired into the existing Salesforce block config

Sequence Diagram

sequenceDiagram
    participant SF as Salesforce Flow
    participant WH as Sim Webhook Endpoint
    participant TR as Trigger Registry
    participant WF as Workflow Engine

    SF->>WH: POST /webhook/{path}<br/>(JSON: eventType, objectType, record, ...)
    WH->>TR: Lookup TriggerConfig by triggerId
    Note over TR: salesforce_record_created<br/>salesforce_record_updated<br/>salesforce_record_deleted<br/>salesforce_opportunity_stage_changed<br/>salesforce_case_status_changed<br/>salesforce_webhook
    TR-->>WH: TriggerConfig (outputs schema)
    WH->>WF: Execute workflow with mapped outputs
    WF-->>SF: 200 OK
Loading

Reviews (2): Last reviewed commit: "fix(triggers): address PR review — remov..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/salesforce-trigger branch from 8f1efd8 to ce78227 Compare April 6, 2026 17:44
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d67ab32. Configure here.

@waleedlatif1 waleedlatif1 merged commit 925be3d into staging Apr 6, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/salesforce-trigger branch April 6, 2026 18:06
waleedlatif1 added a commit that referenced this pull request Apr 6, 2026
* feat(triggers): add Salesforce webhook triggers

* fix(triggers): address PR review — remove non-TSDoc comment, fix generic webhook instructions
emir-karabeg pushed a commit that referenced this pull request Apr 7, 2026
* feat(triggers): add Salesforce webhook triggers

* fix(triggers): address PR review — remove non-TSDoc comment, fix generic webhook instructions
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.

1 participant