The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
send only active webhooks
Kiran K8d815eada72b
diff --git a/apps/web/lib/tinybird/record-click.ts b/apps/web/lib/tinybird/record-click.tsindex 7a81e6e45a..23a4633794 100644--- a/apps/web/lib/tinybird/record-click.ts+++ b/apps/web/lib/tinybird/record-click.ts@@ -158,6 +158,7 @@ export async function recordClick({const linkWebhooks = webhooks.filter((webhook) =>webhook.triggers &&+ !webhook.disabled &&Array.isArray(webhook.triggers) &&webhook.triggers.includes("link.clicked"),);diff --git a/apps/web/lib/webhook/publish-edge.ts b/apps/web/lib/webhook/publish-edge.tsindex 9d6b374e1c..dd9c4aed32 100644--- a/apps/web/lib/webhook/publish-edge.ts+++ b/apps/web/lib/webhook/publish-edge.ts@@ -20,6 +20,7 @@ export const sendWorkspaceWebhookOnEdge = async ({const webhooks = await prismaEdge.webhook.findMany({where: {projectId: workspace.id,+ disabled: false,triggers: {array_contains: [trigger],},@@ -28,7 +29,6 @@ export const sendWorkspaceWebhookOnEdge = async ({id: true,url: true,secret: true,- disabled: true,},});diff --git a/apps/web/lib/webhook/publish.ts b/apps/web/lib/webhook/publish.tsindex 7a1e810182..29ab31b25e 100644--- a/apps/web/lib/webhook/publish.ts+++ b/apps/web/lib/webhook/publish.ts@@ -24,6 +24,7 @@ export const sendWorkspaceWebhook = async ({const webhooks = await prisma.webhook.findMany({where: {projectId: workspace.id,+ disabled: false,triggers: {array_contains: [trigger],},@@ -32,7 +33,6 @@ export const sendWorkspaceWebhook = async ({id: true,url: true,secret: true,- disabled: true,},});diff --git a/apps/web/lib/webhook/qstash.ts b/apps/web/lib/webhook/qstash.tsindex c97b5eff6b..a354b41b1e 100644--- a/apps/web/lib/webhook/qstash.ts+++ b/apps/web/lib/webhook/qstash.ts@@ -14,7 +14,7 @@ export const sendWebhooks = async ({trigger,data,}: {- webhooks: Pick<Webhook, "id" | "url" | "secret" | "disabled">[];+ webhooks: Pick<Webhook, "id" | "url" | "secret">[];trigger: WebhookTrigger;data: EventDataProps;}) => {@@ -22,16 +22,10 @@ export const sendWebhooks = async ({return;}- const activeWebhooks = webhooks.filter((webhook) => !webhook?.disabled);-- if (activeWebhooks.length === 0) {- return;- }-const payload = prepareWebhookPayload(trigger, data);return await Promise.all(- activeWebhooks.map((webhook) =>+ webhooks.map((webhook) =>publishWebhookEventToQStash({ webhook, payload }),),);