The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
small tweaks dub webhooks
Steven Teyb647fb6a932d
diff --git a/apps/web/app/api/dub/webhook/lead-created.ts b/apps/web/app/api/dub/webhook/lead-created.tsindex 930942cb2b..c0d7c64038 100644--- a/apps/web/app/api/dub/webhook/lead-created.ts+++ b/apps/web/app/api/dub/webhook/lead-created.ts@@ -85,5 +85,5 @@ export async function leadCreated(data: any) {// sendMerchLink(workspace.id),]);- return `Successfully tracked referral signup for ${workspace.name} (slug: ${workspace.slug})`;+ return `Successfully handled referral signup event for ${workspace.name} (slug: ${workspace.slug})`;}diff --git a/apps/web/app/api/dub/webhook/sale-created.ts b/apps/web/app/api/dub/webhook/sale-created.tsindex 45e49c5334..56275c9096 100644--- a/apps/web/app/api/dub/webhook/sale-created.ts+++ b/apps/web/app/api/dub/webhook/sale-created.ts@@ -3,7 +3,7 @@ import { sendEmail } from "emails";import NewReferralSale from "emails/new-referral-sale";export async function saleCreated(data: any) {- const referralLink = data.link;+ const { link: referralLink } = data.sale;if (!referralLink) {return "Referral link not found in webhook payload";@@ -26,7 +26,7 @@ export async function saleCreated(data: any) {});if (!workspace) {- return "Workspace not found";+ return `Referral link workspace not found for ${referralLink.shortLink}`;}const workspaceOwners = workspace.users.map(({ user }) => user);@@ -37,7 +37,7 @@ export async function saleCreated(data: any) {owner.email &&sendEmail({email: owner.email,- subject: `Congrats! You just made a $${(data.sale.amount / 100).toFixed(2)} sale via your Dub referral link!`,+ subject: `Congrats! You just made a $${Math.round(data.sale.amount / 100).toLocaleString()} sale via your Dub referral link!`,react: NewReferralSale({email: owner.email,workspace,@@ -47,5 +47,5 @@ export async function saleCreated(data: any) {),);- return `Successfully tracked referral sale for ${workspace.name} (slug: ${workspace.slug})`;+ return `Successfully handled referral sale event for ${workspace.name} (slug: ${workspace.slug})`;}