Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

414 B
Raw Blame
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;
};