mirror of
https://github.com/mfts/papermark.git
synced 2025-12-20 01:03:24 +08:00
16 lines
414 B
TypeScript
16 lines
414 B
TypeScript
import { newId } from "@/lib/id-helper";
|
|
import { webhookPayloadSchema } from "@/lib/zod/schemas/webhooks";
|
|
|
|
import { WebhookTrigger } from "./types";
|
|
|
|
export const prepareWebhookPayload = (trigger: WebhookTrigger, data: any) => {
|
|
const payload = webhookPayloadSchema.parse({
|
|
id: newId("webhookEvent"),
|
|
event: trigger,
|
|
data: data,
|
|
createdAt: new Date().toISOString(),
|
|
});
|
|
|
|
return payload;
|
|
};
|