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.

event_ → evt_, id → clickId

Steven Tey5c56631c6a5f
diff --git a/apps/web/lib/webhook/constants.ts b/apps/web/lib/webhook/constants.ts
index 17bf038be6..1c4789230b 100644
--- a/apps/web/lib/webhook/constants.ts
+++ b/apps/web/lib/webhook/constants.ts
@@ -4,7 +4,7 @@ export const WEBHOOK_ID_PREFIX = "wh_";
export const WEBHOOK_SECRET_PREFIX = "whsec_";
-export const WEBHOOK_EVENT_ID_PREFIX = "event_";
+export const WEBHOOK_EVENT_ID_PREFIX = "evt_";
export const WEBHOOK_REDIS_KEY = "dub:webhooks";
diff --git a/apps/web/lib/webhook/sample-events/click.json b/apps/web/lib/webhook/sample-events/click.json
index ac1f416003..261318ddda 100644
--- a/apps/web/lib/webhook/sample-events/click.json
+++ b/apps/web/lib/webhook/sample-events/click.json
@@ -1,5 +1,5 @@
{
- "id": "event_0HInCovrWBDmIQBAsCcY1xZlK",
+ "id": "evt_0HInCovrWBDmIQBAsCcY1xZlK",
"event": "link.clicked",
"createdAt": "2024-08-26T16:37:15.889Z",
"data": {
diff --git a/apps/web/lib/webhook/sample-events/lead.json b/apps/web/lib/webhook/sample-events/lead.json
index 6f830a7be8..d637c889c8 100644
--- a/apps/web/lib/webhook/sample-events/lead.json
+++ b/apps/web/lib/webhook/sample-events/lead.json
@@ -1,5 +1,5 @@
{
- "id": "event_LiTGZBn26j8XDpfbVtZyEWOtx",
+ "id": "evt_LiTGZBn26j8XDpfbVtZyEWOtx",
"event": "lead.created",
"createdAt": "2024-08-26T17:50:25.001Z",
"data": {
diff --git a/apps/web/lib/webhook/sample-events/link-created.json b/apps/web/lib/webhook/sample-events/link-created.json
index 56069b47c3..f33855801c 100644
--- a/apps/web/lib/webhook/sample-events/link-created.json
+++ b/apps/web/lib/webhook/sample-events/link-created.json
@@ -1,5 +1,5 @@
{
- "id": "event_KleiO4HBwZFbO1vZLWIPZ2AtX",
+ "id": "evt_KleiO4HBwZFbO1vZLWIPZ2AtX",
"event": "link.created",
"createdAt": "2024-08-26T16:41:52.346Z",
"data": {
diff --git a/apps/web/lib/webhook/sample-events/link-deleted.json b/apps/web/lib/webhook/sample-events/link-deleted.json
index e302fe9f75..21b566cc55 100644
--- a/apps/web/lib/webhook/sample-events/link-deleted.json
+++ b/apps/web/lib/webhook/sample-events/link-deleted.json
@@ -1,5 +1,5 @@
{
- "id": "event_KleiO4HBwZFbO1vZLWIPZ2AtX",
+ "id": "evt_KleiO4HBwZFbO1vZLWIPZ2AtX",
"event": "link.deleted",
"createdAt": "2024-08-26T16:41:52.346Z",
"data": {
diff --git a/apps/web/lib/webhook/sample-events/sale.json b/apps/web/lib/webhook/sample-events/sale.json
index fbba34ad6d..d62664f8e9 100644
--- a/apps/web/lib/webhook/sample-events/sale.json
+++ b/apps/web/lib/webhook/sample-events/sale.json
@@ -1,5 +1,5 @@
{
- "id": "event_d6QRfbCvrVFcZx2pJ3dUm8Aum",
+ "id": "evt_d6QRfbCvrVFcZx2pJ3dUm8Aum",
"event": "sale.created",
"createdAt": "2024-08-26T13:30:57.703Z",
"data": {
diff --git a/apps/web/lib/webhook/schemas.ts b/apps/web/lib/webhook/schemas.ts
index c0d150a130..423a753345 100644
--- a/apps/web/lib/webhook/schemas.ts
+++ b/apps/web/lib/webhook/schemas.ts
@@ -5,7 +5,7 @@ import { WEBHOOK_TRIGGERS } from "./constants";
export const linkEventSchema = LinkSchema;
export const clickEventSchema = z.object({
- id: z.string(),
+ clickId: z.string(),
aliasLinkId: z.string(),
url: z.string(),
ip: z.string(),
diff --git a/apps/web/lib/webhook/transform.ts b/apps/web/lib/webhook/transform.ts
index 3a9282cb87..aa899d8b4e 100644
--- a/apps/web/lib/webhook/transform.ts
+++ b/apps/web/lib/webhook/transform.ts
@@ -59,7 +59,6 @@ export const transformLeadEventData = (data: any) => {
...lead,
click: {
...lead,
- id: lead.clickId,
qr: lead.qr === 1,
bot: lead.bot === 1,
},
@@ -81,7 +80,6 @@ export const transformSaleEventData = (data: any) => {
...sale,
click: {
...sale,
- id: sale.clickId,
qr: sale.qr === 1,
bot: sale.bot === 1,
},