01 / Workflow
Publish a Durable Event
Enqueue an event with an idempotency key. HookRail fans out to all matching tenant endpoints with automatic retries.
src/billing/emit.ts
import { HookRail } from "@hookrail/sdk";
const bus = new HookRail({ apiKey: process.env.HOOKRAIL_KEY });
await bus.events.publish({
tenantId: "org_4920",
type: "invoice.settled",
idempotencyKey: "inv_8831_v1",
payload: { invoiceId: "inv_8831", amountCents: 49000, currency: "USD" },
});