Skip to content

feat(backend): webhook subscription create/list/delete with signed payloads (#997) - #1135

Merged
Akanimoh12 merged 1 commit into
Akanimoh12:test-implement-dripsfrom
dannyy2000:feat/webhooks-997-subscriptions-crud
Jul 27, 2026
Merged

feat(backend): webhook subscription create/list/delete with signed payloads (#997)#1135
Akanimoh12 merged 1 commit into
Akanimoh12:test-implement-dripsfrom
dannyy2000:feat/webhooks-997-subscriptions-crud

Conversation

@dannyy2000

@dannyy2000 dannyy2000 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #997
Closes #996
Closes #1005
Closes #1011

This is part of the webhooks/analytics work tracked across four related issues:

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)

  • Added a WebhookSubscription Prisma model: url, a per-subscription HMAC-SHA256 secret, events, ownerId, status, and soft-delete (deletedAt).
  • Repointed WebhookDelivery.subscriptionId at WebhookSubscription — it previously referenced the unrelated billing Subscription model 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 signing secret once, 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.tsgenerateWebhookSecret, signWebhookPayload (HMAC-SHA256, hex), verifyWebhookSignature (constant-time comparison via timingSafeEqual).
  • Webhook URLs must be https://.

Test plan

  • npm run typecheck — no new errors (pre-existing unrelated errors in ipfs, credit, realtime, analytics confirmed present on test-implement-drips before 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 on test-implement-drips without this change.)
  • Migration SQL generated via prisma migrate diff against the schema change (not hand-written), but not applied against a live database in this environment — please run npm run prisma:migrate locally to verify it applies cleanly.

…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
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Akanimoh12
Akanimoh12 merged commit 3f081f1 into Akanimoh12:test-implement-drips Jul 27, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants