feat(triggers): add Notion webhook triggers#3989
Conversation
Add 9 Notion webhook triggers covering the full event lifecycle: - Page events: created, properties updated, content updated, deleted - Database events: created, schema updated, deleted - Comment events: created - Generic webhook trigger (all events) Implements provider handler with HMAC SHA-256 signature verification, event filtering via matchEvent, and structured input formatting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR SummaryMedium Risk Overview Implements and registers a Reviewed by Cursor Bugbot for commit d2719f5. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds 9 Notion webhook triggers covering the full event lifecycle: page (created, properties updated, content updated, deleted), database (created, schema updated, deleted), comment (created), and a generic all-events trigger. It introduces a Key implementation highlights:
Minor findings:
Confidence Score: 5/5This PR is safe to merge; only minor style suggestions remain after previously-reported P1 issues were resolved. Both prior P1 findings (type field collision from spread in output builders, confusing verification_token description) were fixed in follow-up commits. The remaining findings are P2 style issues (awkward setup instructions text, logger.debug usage) that do not affect correctness or security. The HMAC verification logic, event routing, output schemas, and registry wiring are all correct. No files require special attention; webhook.ts has minor text wording worth cleaning up but does not block merge. Important Files Changed
Sequence DiagramsequenceDiagram
participant N as Notion
participant S as Sim Webhook Endpoint
participant H as notionHandler
participant U as isNotionPayloadMatch
participant W as Workflow
N->>S: POST /webhook/{path} + X-Notion-Signature header
S->>H: verifyAuth (createHmacVerifier)
H-->>H: validateNotionSignature (HMAC SHA-256)
alt no webhookSecret configured
H-->>S: null (pass-through)
else signature missing
H-->>S: 401 Unauthorized
S-->>N: 401
else signature invalid
H-->>S: 401 Unauthorized
S-->>N: 401
else valid
H-->>S: null (continue)
end
S->>H: matchEvent (triggerId from providerConfig)
alt triggerId == notion_webhook
H-->>S: true (accept all events)
else specific trigger ID
H->>U: isNotionPayloadMatch(triggerId, body)
alt body.type in TRIGGER_EVENT_MAP[triggerId]
U-->>H: true
H-->>S: true
else event type mismatch
U-->>H: false
H-->>S: 200 {message: ignored}
S-->>N: 200
end
end
S->>H: formatInput
H-->>S: {id, type, timestamp, authors, entity, data, …}
S->>W: execute workflow with structured input
W-->>N: 200 OK
Reviews (3): Last reviewed commit: "refactor(webhooks): use createHmacVerifi..." | Re-trigger Greptile |
Rename nested `type` fields to `entity_type`/`parent_type` to avoid collision with processOutputField's leaf node detection which checks `'type' in field`. Remove spread of author outputs into `authors` array which was overwriting `type: 'array'`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…token Update placeholder and description to distinguish the signing secret (used for HMAC-SHA256 signature verification) from the verification_token (one-time challenge echoed during initial setup). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
Replace inline verifyAuth boilerplate with createHmacVerifier utility, consistent with Linear, Ashby, Cal.com, Circleback, Confluence, and Fireflies providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@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 d2719f5. Configure here.
Summary
matchEvent, and structured input formatting — following the newWebhookProviderHandlerregistry patternTest plan
X-Notion-Signatureheaderpage.createdevent only triggersnotion_page_created, not other triggersnotion_webhooktrigger receives all event types