feat(triggers): add Linear v2 triggers with automatic webhook registration#3991
feat(triggers): add Linear v2 triggers with automatic webhook registration#3991waleedlatif1 merged 5 commits intostagingfrom
Conversation
PR SummaryMedium Risk Overview Adds Extends the Linear webhook provider with Reviewed by Cursor Bugbot for commit f6ea743. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds 15 Linear v2 triggers with automatic webhook lifecycle management — users provide an API key and Sim registers/deregisters webhooks in Linear automatically via the GraphQL API, replacing the manual copy-paste flow of the v1 triggers.
Confidence Score: 5/5Safe to merge — all remaining findings are P2 style/observability suggestions; no correctness, security, or data-integrity issues found The HTTP-status-check concern from a prior review was already resolved. Core logic (webhook registration, HMAC verification, event routing, delete cleanup, backwards compatibility) is correct and well-guarded. All project rules are followed: user-only visibility for the API key, generateId() for the webhook secret, createLogger for all logging, absolute imports, and no console.log. No files require special attention. apps/sim/lib/webhooks/providers/linear.ts is the most critical file (external API calls + secret handling) and is correctly implemented. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LinearV2Block
participant Sim
participant LinearAPI
User->>LinearV2Block: Enter API Key + optional Team ID,<br/>select trigger type via dropdown
User->>LinearV2Block: Click Save Configuration
LinearV2Block->>Sim: createSubscription()
Note over Sim: Look up resourceTypes via LINEAR_RESOURCE_TYPE_MAP<br/>Generate webhookSecret = generateId()
Sim->>LinearAPI: POST /graphql — WebhookCreate mutation<br/>(url, resourceTypes, secret, teamId | allPublicTeams)
LinearAPI-->>Sim: { success: true, webhook: { id } }
Note over Sim: Store externalId + webhookSecret in providerConfig
Note over LinearAPI,Sim: Later: Linear fires an event
LinearAPI->>Sim: POST /api/webhooks/trigger/{path}<br/>Linear-Signature: hmac-sha256 header
Note over Sim: verifyAuth — HMAC-SHA256(webhookSecret, rawBody)
Note over Sim: matchEvent — isLinearEventMatch(triggerId, type, action)<br/>strips _v2 suffix; _webhook_v2 always passes
alt type + action matches triggerId
Sim-->>LinearAPI: 200 OK — workflow executes
else No match
Note over Sim: Skip — log mismatch, no workflow run
end
Note over User,Sim: On trigger delete
User->>LinearV2Block: Remove trigger
LinearV2Block->>Sim: deleteSubscription()
Sim->>LinearAPI: POST /graphql — WebhookDelete(id: externalId)
LinearAPI-->>Sim: { success: true }
Note over Sim: Non-fatal — warn + return on any error
Reviews (4): Last reviewed commit: "fix build" | Re-trigger Greptile |
|
Both issues addressed in fd7c856:
|
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 fd7c856. Configure here.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 f6ea743. Configure here.
…ation (#3991) * feat(triggers): add Linear v2 triggers with automatic webhook registration * fix(triggers): preserve specific Linear API error messages in catch block * fix(triggers): check response.ok before JSON parsing, replace as any with as unknown * fix linear subscription params * fix build --------- Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Summary
Type of Change
Testing
Tested manually
Checklist