feat(backend): webhook subscription create/list/delete with signed payloads (#997) - #1135
Merged
Akanimoh12 merged 1 commit intoJul 27, 2026
Conversation
…yloads Adds a WebhookSubscription model (url, per-subscription HMAC-SHA256 secret, events, owner, soft-delete) and repoints WebhookDelivery at it — it previously referenced the unrelated billing Subscription model. - POST /webhooks/subscriptions — register a subscription, returns the signing secret once - GET /webhooks/subscriptions — list the caller's subscriptions (secret omitted) - DELETE /webhooks/subscriptions/:id — soft-delete, owner only - webhooks.signing.ts — generateWebhookSecret / signWebhookPayload / verifyWebhookSignature (HMAC-SHA256, constant-time verification) Closes Akanimoh12#997
|
@dannyy2000 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Akanimoh12
merged commit Jul 27, 2026
3f081f1
into
Akanimoh12:test-implement-drips
4 of 5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #997
Closes #996
Closes #1005
Closes #1011
This is part of the webhooks/analytics work tracked across four related issues:
GET /stats/overview(platform totals) — not implemented here.This PR implements #997 only. #996, #1005, and #1011 are separate, still-open issues — no code for them is included, so they aren't marked as closed by this PR.
What changed (#997)
WebhookSubscriptionPrisma model:url, a per-subscription HMAC-SHA256secret,events,ownerId,status, and soft-delete (deletedAt).WebhookDelivery.subscriptionIdatWebhookSubscription— it previously referenced the unrelated billingSubscriptionmodel from an earlier PR, which meant the delivery-log endpoints (Webhooks: Webhook delivery log endpoint #1001) had nothing real to reference.POST /api/v1/webhooks/subscriptions— registers a subscription for the authenticated user; response includes the signingsecretonce, on creation only.GET /api/v1/webhooks/subscriptions— paginated list of the caller's own subscriptions (secret never included).DELETE /api/v1/webhooks/subscriptions/:id— soft-delete, owner-only (403 otherwise, 404 if missing/already deleted).webhooks.signing.ts—generateWebhookSecret,signWebhookPayload(HMAC-SHA256, hex),verifyWebhookSignature(constant-time comparison viatimingSafeEqual).https://.Test plan
npm run typecheck— no new errors (pre-existing unrelated errors inipfs,credit,realtime,analyticsconfirmed present ontest-implement-dripsbefore this change too).npm run lint— clean (0 errors) on changed files.npm run test— new webhook tests (signing + CRUD, Prisma mocked) all pass; no regressions in previously-passing suites. (Some DB-backed integration tests fail in this sandbox for lack of a live Postgres instance — same failures exist ontest-implement-dripswithout this change.)prisma migrate diffagainst the schema change (not hand-written), but not applied against a live database in this environment — please runnpm run prisma:migratelocally to verify it applies cleanly.