Package Exports
- @lovable.dev/webhooks-js
- @lovable.dev/webhooks-js/dist/index.cjs
- @lovable.dev/webhooks-js/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lovable.dev/webhooks-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@lovable.dev/webhooks-js
Webhook signature utilities for Lovable integrations.
Installation
npm install @lovable.dev/webhooks-jsUsage
import {
verifyWebhookRequest,
verifyWebhookSignature,
type EmailWebhookPayload,
} from "@lovable.dev/webhooks-js";
const body = await req.text();
const signature = req.headers.get("x-lovable-signature");
const timestamp = req.headers.get("x-lovable-timestamp") ?? "";
const isValid = await verifyWebhookSignature({
signedPayload: `${timestamp}.${body}`,
signature,
secret: Deno.env.get("LOVABLE_API_KEY") ?? "",
});
if (!isValid) {
throw new Error("Invalid signature");
}
// Or verify the request and parse JSON in one step
const { payload } = await verifyWebhookRequest<EmailWebhookPayload>({
req,
secret: Deno.env.get("LOVABLE_API_KEY") ?? "",
});
// Or pass a custom parser
const { payload: rawPayload } = await verifyWebhookRequest({
req,
secret: Deno.env.get("LOVABLE_API_KEY") ?? "",
parser: (body) => ({ raw: body }),
});