unsend icon indicating copy to clipboard operation
unsend copied to clipboard

webhooks baby

Open KMKoushik opened this issue 4 weeks ago • 4 comments


Summary by cubic

Adds first-class webhooks: dashboard UI for endpoint management, signed delivery with retries, and event emission for email, domain, and contact events. This enables teams to receive real-time updates and review delivery history.

  • New Features

    • New Webhook and WebhookCall tables with statuses, indexes, and foreign keys.
    • Webhook TRPC API: list, create (plan limits: Free=1, Basic=unlimited), update, setStatus, delete, test, listCalls, getCall, retryCall.
    • BullMQ dispatch worker with HMAC-signed POSTs, exponential backoff, per-webhook locks, response capture, and auto-disable after repeated failures.
    • Daily cleanup job removes webhook call logs older than 30 days.
    • Emits events from SES hook parser (queued, sent, delivered, bounced, opened, clicked, etc.), domain service (created, verified, updated, deleted), and contact service (created, updated, deleted).
    • New shared package @usesend/lib with webhook event types and SES error constants; imports updated accordingly.
  • Migration

    • Run Prisma migrations.
    • Ensure Redis is configured and the worker processes are running (dispatch queue and cleanup scheduler).

Written for commit c96032edf51b6fdf47aeeb6be50ea332e106b9fe. Summary will update automatically on new commits.

Summary by CodeRabbit

  • New Features

    • Full webhook system: create/edit/delete/list webhooks, test and retry deliveries, call history, signing, retries with backoff and auto-disable, and daily cleanup of old calls.
    • UI: Webhooks management pages and dialogs for adding, editing, testing, and deleting webhooks; per-event selection and “all events” option.
    • Webhook events emitted for email, domain, and contact lifecycle actions; plan-based webhook limits with upgrade prompts.
  • Chores

    • Added a new shared library package consumed by the web app.

✏️ Tip: You can customize this high-level summary in your review settings.

KMKoushik avatar Nov 28 '25 21:11 KMKoushik

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
unsend-marketing Ready Ready Preview Comment Nov 30, 2025 10:48am

vercel[bot] avatar Nov 28 '25 21:11 vercel[bot]

[!NOTE]

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a webhook subsystem and a new shared library. Introduces package @usesend/lib with webhook typings and utilities, Prisma enums/models and a migration (Webhook, WebhookCall, WebhookStatus, WebhookCallStatus), a TRPC webhook router and API exposure, a delivery service with queueing/retries/locking/signing, a daily cleanup job and queue constants, UI for managing webhooks (list, add, edit, delete, test), integrations that emit webhook events from domain and SES flows, plan/limit checks for webhooks, and import/config updates (Tailwind, ESLint, tsconfig).

Possibly related PRs

  • usesend/useSend PR 238: Adds a top-level TRPC route — overlaps with adding the new webhook router to the main appRouter.
  • usesend/useSend PR 203: Modifies plan/limits surface — touches the same plan/limit constants and logic used for webhook limits.
  • usesend/useSend PR 198: Modifies domain-service — both PRs add webhook event emission in domain-related flows.

Suggested labels

codex

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'webhooks baby' is vague and uses informal, non-descriptive language that does not clearly convey the substantial changes introduced in this PR. Consider a more descriptive title that summarizes the main feature, such as 'Add webhook management system with signed delivery and dashboard UI' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 28 '25 21:11 coderabbitai[bot]

Deploying usesend with  Cloudflare Pages  Cloudflare Pages

Latest commit: c96032e
Status: ✅  Deploy successful!
Preview URL: https://b9f784df.usesend.pages.dev
Branch Preview URL: https://km-2025-11-17-webhook.usesend.pages.dev

View logs

thanks @marconneves for the intial works

KMKoushik avatar Nov 28 '25 23:11 KMKoushik