Send, store and verify webhooks. Typed from the schema you send to the payload your customers receive.
Declare events once. Send them signed, right away or after your transaction commits. Verify them with the types attached.
import { webhooks } from "@typedhook/sdk";
import { z } from "zod";
export const wh = webhooks({
events: {
"invoice.paid": z.object({ invoiceId: z.string(), amountCents: z.number() }),
},
subscribers: async ({ event, subject }) => db.findSubscribers(event, subject),
signing: { secret: process.env.WEBHOOK_SECRET! },
});
const result = await wh.send({
event: "invoice.paid",
subject: "acct_42",
data: { invoiceId: "inv_1", amountCents: 4200 },
});
if (!result.ok) console.error(result.error); // never throwsAny Standard Schema library. The event name narrows data.
Each event names the account it's for, signed into the body.
The event commits with your data, or not at all.
30s, doubling up to 1h. After 20 attempts the row is marked dead.
Zero dependencies. WebCrypto only. Never throws on a bad request.
They import your event types and get typed payloads.
Install the sender, declare one event and call send(). About five minutes.