Skip to content

feat(triggers): add HubSpot merge, restore, and generic webhook triggers#3983

Merged
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/hubspot-trigger
Apr 6, 2026
Merged

feat(triggers): add HubSpot merge, restore, and generic webhook triggers#3983
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/hubspot-trigger

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add merge and restore triggers for contacts, companies, deals, and tickets
  • Add generic webhook trigger for catching all HubSpot events
  • Update event map, dropdown options, block config, and registry

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 6:01pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 6, 2026

PR Summary

Medium Risk
Medium risk: adds multiple new HubSpot trigger entry points (including an all-events webhook) and expands event matching/output schemas, which could cause unexpected workflow executions or mis-scoped setup if misconfigured.

Overview
Adds new HubSpot triggers for merge and restore events across contacts/companies/deals/tickets, plus a generic hubspot_webhook trigger that can accept any HubSpot webhook payload.

Updates HubSpot trigger discovery/UI wiring (hubspotAllTriggerOptions, block trigger subBlocks, exports, and TRIGGER_REGISTRY) and extends hubspotSetupInstructions to derive required OAuth scopes per event type; merge triggers now expose mergedObjectIds via a dedicated output schema and the event-type map is expanded to include the new trigger IDs.

Reviewed by Cursor Bugbot for commit c9487c2. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 6, 2026

Greptile Summary

This PR expands the HubSpot integration by adding 10 new trigger configurations: merge and restore events for contacts, companies, deals, and tickets, plus a generic webhook trigger that captures all HubSpot events. The implementation follows existing HubSpot trigger patterns faithfully — each trigger has the correct credential sub-blocks, curl command setup instructions, sample payloads, and merge-specific outputs (with mergedObjectIds) where appropriate. All new event types (contact.merge, contact.restore, etc.) are confirmed valid HubSpot Webhooks API v3 subscription types.

  • 9 new specialized triggers added for merge/restore events across all 4 HubSpot CRM entity types
  • 1 generic webhook trigger (hubspot_webhook) added that passes all events through without filtering
  • isHubSpotContactEventMatch event map expanded with all 10 new event types; unknown trigger IDs (including hubspot_webhook) return true by design, allowing all events through
  • All new triggers properly registered in registry.ts and wired into blocks/blocks/hubspot.ts
  • Minor TypeScript hygiene: as any in buildMergeHubSpotOutputs and Record<string, any> in curlSetWebhookUrl value callbacks across all new trigger files

Confidence Score: 5/5

This PR is safe to merge — all findings are P2 style suggestions with no runtime impact

All three flagged issues are TypeScript style violations (as any, Record<string, any>, misleading function name) that do not affect runtime behavior. The new triggers correctly implement the confirmed-valid HubSpot API v3 event types and follow established project patterns faithfully.

apps/sim/triggers/hubspot/utils.ts has two minor TypeScript hygiene issues (as any cast and misleading function name) worth cleaning up

Important Files Changed

Filename Overview
apps/sim/triggers/hubspot/utils.ts Central utility module expanded with merge/restore output builders and updated event map; new buildMergeHubSpotOutputs uses as any cast and isHubSpotContactEventMatch is misleadingly named for its all-entity scope
apps/sim/triggers/hubspot/webhook.ts New generic catch-all webhook trigger; passes all HubSpot events through via the unknown-trigger passthrough in isHubSpotContactEventMatch
apps/sim/triggers/hubspot/index.ts Barrel export expanded with all 10 new triggers; exports isHubSpotContactEventMatch which will need renaming if function is renamed
apps/sim/triggers/registry.ts All 10 new triggers correctly registered using canonical IDs
apps/sim/blocks/blocks/hubspot.ts Block config updated with new trigger subBlocks and available trigger IDs for all 10 new triggers
apps/sim/triggers/hubspot/contact_merged.ts New trigger for contact.merge events; follows existing HubSpot trigger patterns; Record<string, any> in curlSetWebhookUrl value callback
apps/sim/triggers/hubspot/contact_restored.ts New trigger for contact.restore events; mirrors contact_merged structure with correct event type and outputs
apps/sim/triggers/hubspot/company_merged.ts New trigger for company.merge events; correctly uses buildCompanyMergedOutputs with mergedObjectIds
apps/sim/triggers/hubspot/company_restored.ts New trigger for company.restore events; follows existing pattern correctly
apps/sim/triggers/hubspot/deal_merged.ts New trigger for deal.merge events; correctly uses buildDealMergedOutputs with mergedObjectIds
apps/sim/triggers/hubspot/deal_restored.ts New trigger for deal.restore events; follows existing pattern correctly
apps/sim/triggers/hubspot/ticket_merged.ts New trigger for ticket.merge events; correctly uses buildTicketMergedOutputs with mergedObjectIds
apps/sim/triggers/hubspot/ticket_restored.ts New trigger for ticket.restore events; follows existing pattern correctly

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[HubSpot sends POST webhook] --> B[Sim webhook endpoint]
    B --> C{isHubSpotEventMatch check}
    C -->|contact.merge| D[hubspot_contact_merged]
    C -->|contact.restore| E[hubspot_contact_restored]
    C -->|company.merge| F[hubspot_company_merged]
    C -->|company.restore| G[hubspot_company_restored]
    C -->|deal.merge| H[hubspot_deal_merged]
    C -->|deal.restore| I[hubspot_deal_restored]
    C -->|ticket.merge| J[hubspot_ticket_merged]
    C -->|ticket.restore| K[hubspot_ticket_restored]
    C -->|unknown triggerId returns true| L[hubspot_webhook\nAll Events passthrough]
    D & E & F & G & H & I & J & K --> M[Workflow execution\ntyped outputs incl. mergedObjectIds]
    L --> N[Workflow execution\ngeneric event payload]
Loading

Reviews (2): Last reviewed commit: "lint" | Re-trigger Greptile

@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 c9487c2. Configure here.

@waleedlatif1 waleedlatif1 merged commit c9b45f4 into staging Apr 6, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/hubspot-trigger branch April 6, 2026 18:15
waleedlatif1 added a commit that referenced this pull request Apr 6, 2026
…ers (#3983)

* feat(triggers): add HubSpot merge, restore, and generic webhook triggers

* fix(triggers): add mergedObjectIds to merge trigger output schemas

* fix(triggers): derive correct OAuth scope per HubSpot object type in setup instructions

* lint
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