feat(backend): Add webhook delivery system for card view events#590
feat(backend): Add webhook delivery system for card view events#590Dipti45sktech wants to merge 7 commits into
Conversation
|
@Dipti45sktech is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @Dipti45sktech, Thanks for opening this pull request. This PR has been automatically classified based on the files modified. Applied Labels
Primary Review Area
Reviewer@Harxhit has been identified as the primary reviewer for this pull request. If you have any questions regarding the affected area or implementation details, feel free to reach out to the assigned reviewer. Thank you for your contribution! |
CI — All Checks PassedBackend — PASS
Mobile — SKIP
Web — SKIP
Last updated: |
|
Hi @ShantKhatri please reassign me on issue #40 - I had completed this implementation earlier but the PR had to be closed due to branch conflicts. This is a clean resubmission of the same work. Kindly take a look. |
Harxhit
left a comment
There was a problem hiding this comment.
Review of the webhook delivery system. The route/dispatch design is solid (HMAC signing, encrypted secret at rest, ownership checks, endpoint cap), but there are blocking issues: the Prisma schema is corrupted, the core WebhookEndpoint model is missing, and dispatchWebhook is never called from any event handler — so card-view/contact-save events don't actually trigger anything as shipped. Inline comments below. Note: this PR also carries unrelated changes (CI lint removal, app.ts/auth/seed rewrites) that I'd recommend splitting out.
Signed-off-by: Dipti45sktech <kdsofficial.0106@gmail.com>
|
Hi @ShantKhatri and @Harxhit, thank you for the thorough review - I've addressed all the comments. Please let me know if anything else needs attention! Please also make changes in DB seed too. |
|
@Dipti45sktech Could please also add DB seed and DB migrations proofs in PR description. |
Summary
Implements the full webhook delivery system for card view and contact-save events as specified in issue #40. This includes endpoint registration, HMAC-SHA256 payload signing, exponential backoff retry logic, delivery logging, and full test coverage. The idea is simple — when someone views a card or saves a contact, any external system that has registered a webhook endpoint should get notified automatically with a signed POST request.
Closes #40
Type of Change
What Changed
WebhookEndpointandWebhookDeliverymodels to Prisma schemaapps/backend/src/routes/webhooks.tswith 4 REST endpoints (POST to register, GET to list, DELETE to remove, GET deliveries for logs)apps/backend/src/utils/webhookDispatch.tswith HMAC-SHA256 payload signing viax-DevCard-Signatureheader and retry logic with exponential backoff (30s - 5min - 30min)dispatchWebhookinto card view and contact-save events inapp.tswebhooks.test.tscovering endpoint registration, signature generation, and delivery retry logic.How to Test
pnpm -r run test- all 17 webhook tests should passPOST /api/webhooksx-DevCard-SignatureheaderChecklist
pnpm -r run test).console.logor debug statements left in the code.