@notifkit/provider-resend
The email transport. Sends through Resend and mounts a webhook route that feeds opens, clicks, bounces and complaints back into your delivery log and the suppression list.
npm install @notifkit/provider-resend
Commit an .npmrc without legacy-peer-deps=true. Otherwise the lockfile misses React peers and npm ci fails in Docker or CI.
import { NotifkitServer } from "notifkit";
import { ResendTransport } from "@notifkit/provider-resend";
const server = new NotifkitServer({
services: ["all"],
providers: [
new ResendTransport({
apiKey: process.env.RESEND_KEY!,
from: "[email protected]",
webhookSecret: process.env.RESEND_WEBHOOK_SECRET,
}),
],
});
Options
| Option | Required | Notes |
|---|---|---|
apiKey | yes | Your Resend API key. |
from | yes | Default sender. A template may override it (see below). |
webhookSecret | no | The svix signing secret. Without it every webhook is rejected (see below). |
logger | no | A notifkit logger. Send failures are logged at warn. |
limits | no | Provider rate limit. Defaults to { limit: 1000, windowSeconds: 10 }. |
Which template keys it reads
| Template key | Lands as |
|---|---|
subject | The subject line. Defaults to "Notification" if absent. |
text or body | The plain-text part. |
html or htmlBody | The HTML part. Falls back to the text wrapped in <p>. |
from | Overrides the constructor's sender, for this template only. |
replyTo | Sent only when present. |
Sending from more than one address
The constructor's from is a default. A template's own from wins, so one
transport serves no-reply@ for receipts and marketing@ for campaigns:
await notifkit.syncTemplates({
templates: [
{
id: "receipt",
channel: "email",
content: { from: "[email protected]", subject: "Your receipt", text: "…" },
},
{
id: "spring-sale",
channel: "email",
topic: "promotions",
content: {
from: "Acme Offers <[email protected]>",
replyTo: "[email protected]",
subject: "{{headline}}",
html: "<h1>{{headline}}</h1>",
},
},
],
});
Both accept the display-name form ("Acme <[email protected]>"). A value that isn't a non-empty string is ignored and the default is used.
Webhooks
The transport declares webhookPath = "/webhooks/resend", which the API mounts
automatically. Point Resend at https://your-public-url/webhooks/resend.
| Resend event | Becomes |
|---|---|
email.opened | opened |
email.clicked | clicked, with the URL kept on the log row |
email.bounced | bounced: suppresses only when Resend calls it permanent |
email.complained | complained, which suppresses |
email.delivered, email.delivery_delayed | ignored |
Without webhookSecret every webhook is rejected, so bounces and complaints never suppress the address.