Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

tweak the payload schema

Kiran K5229cd84de42
diff --git a/apps/web/app/api/webhooks/receive/route.ts b/apps/web/app/api/webhooks/receive/route.ts
index 2cd4a228bc..db6175ea17 100644
--- a/apps/web/app/api/webhooks/receive/route.ts
+++ b/apps/web/app/api/webhooks/receive/route.ts
@@ -15,7 +15,7 @@ export const POST = async (req: Request) => {
}
const computedSignature = crypto
- .createHmac("sha256", "whsec_f0dfa39067ee15fdf5abe53c08600c22")
+ .createHmac("sha256", `${process.env.DUB_WEBHOOK_SECRET}`)
.update(JSON.stringify(body))
.digest("hex");
diff --git a/apps/web/lib/actions/test-send-webhook.ts b/apps/web/lib/actions/test-send-webhook.ts
index c504669954..377e54bdc8 100644
--- a/apps/web/lib/actions/test-send-webhook.ts
+++ b/apps/web/lib/actions/test-send-webhook.ts
@@ -33,13 +33,9 @@ export const testSendWebhookEvent = authActionClient
},
});
- const payload = samplePayload[trigger] as z.infer<
- typeof webhookPayloadSchema
- >;
-
await publishWebhookEventToQStash({
webhook,
- payload,
+ payload: webhookPayloadSchema.parse(samplePayload[trigger]),
});
return { ok: true };
diff --git a/apps/web/lib/webhook/sample-events/sale.json b/apps/web/lib/webhook/sample-events/sale.json
index 736c90faf0..fbba34ad6d 100644
--- a/apps/web/lib/webhook/sample-events/sale.json
+++ b/apps/web/lib/webhook/sample-events/sale.json
@@ -38,6 +38,11 @@
"referer": "(direct)",
"refererUrl": "(direct)"
},
- "link": { "id": "cm0aznkw30003139wxprw69nx" }
+ "link": {
+ "id": "cm0atl8tk0001k15k4691jyga",
+ "externalId": null,
+ "domain": "dub.sh",
+ "key": "DUc7ENl"
+ }
}
}