The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
include customer.id and sale.currency in webhook event payload
Steven Tey15f9b96f2746
diff --git a/apps/web/lib/webhook/schemas.ts b/apps/web/lib/webhook/schemas.tsindex ce7799799b..1fc9ff2e20 100644--- a/apps/web/lib/webhook/schemas.ts+++ b/apps/web/lib/webhook/schemas.ts@@ -4,6 +4,7 @@ import { linkEventSchema } from "../zod/schemas/links";import { WEBHOOK_TRIGGERS } from "./constants";const customerSchema = z.object({+ id: z.string(),name: z.string().nullable(),email: z.string().nullable(),avatar: z.string().nullable(),@@ -11,6 +12,7 @@ const customerSchema = z.object({const saleSchema = z.object({amount: z.number(),+ currency: z.string(),paymentProcessor: z.string(),invoiceId: z.string().nullable(),});@@ -22,16 +24,16 @@ export const clickWebhookEventSchema = z.object({export const leadWebhookEventSchema = z.object({eventName: z.string(),+ customer: customerSchema,click: clickEventSchema,link: linkEventSchema,- customer: customerSchema,});export const saleWebhookEventSchema = z.object({eventName: z.string(),+ customer: customerSchema,click: clickEventSchema,link: linkEventSchema,- customer: customerSchema,sale: saleSchema,});diff --git a/apps/web/lib/webhook/transform.ts b/apps/web/lib/webhook/transform.tsindex 2e97b8f3f7..00682d3cd2 100644--- a/apps/web/lib/webhook/transform.ts+++ b/apps/web/lib/webhook/transform.ts@@ -85,9 +85,9 @@ export const transformSaleEventData = (data: any) => {},sale: {amount: sale.amount,+ currency: sale.currency,paymentProcessor: sale.paymentProcessor,invoiceId: sale.invoiceId,- currency: sale.currency,},click: {...sale,diff --git a/apps/web/ui/webhooks/webhook-header.tsx b/apps/web/ui/webhooks/webhook-header.tsxindex 05e2955ada..98c2ef61fb 100644--- a/apps/web/ui/webhooks/webhook-header.tsx+++ b/apps/web/ui/webhooks/webhook-header.tsx@@ -83,9 +83,13 @@ export default function WebhookHeader({ webhookId }: { webhookId: string }) {</div><div><p className="font-semibold text-gray-700">{webhook.name}</p>- <p className="text-pretty text-sm text-gray-500">+ <a+ href={webhook.url}+ target="_blank"+ className="text-pretty text-sm text-gray-500 underline-offset-4 hover:text-gray-700 hover:underline"+ >{webhook.url}- </p>+ </a></div></div>)}