© 2026 Hedgehog Software, LLC
const decodedWebhook = decodeWebhook("eyJhbGc..."); if (decodedWebhook.type === WebhookEventType.userCreated) { // decodedWebhook is type safe userCreated event }
Property 'type' does not exist on type 'Promise<WebhookEvent | null>
import { Hono } from "hono"; import { decodeWebhook } from "@kinde/webhooks"; const app = new Hono(); app.post("/api/auth", async (c) => { const jwt = await c.req.raw.text(); console.log("Received JWT:", jwt); const decoded = decodeWebhook(jwt); console.log("Decoded webhook type:", decoded?.type); if (!decoded) { return c.text("Invalid webhook").status(400); } if (decoded.type === "user.created") { console.log("Handling user.created event:", decoded.data); // Your logic here... } else { console.log("Received unhandled event type:", decoded.type); } return c.text("OK").status(200); }); app.get("/", (c) => c.text("Hello Home!")); export default app;