Skip to content

Commit

Permalink
Update webhook receiver identification for Zapier
Browse files Browse the repository at this point in the history
  • Loading branch information
devkiran committed Jan 13, 2025
1 parent 8c6fb56 commit fb36de4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/web/lib/webhook/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Webhook, WebhookReceiver } from "@dub/prisma/client";
import { LINK_LEVEL_WEBHOOK_TRIGGERS } from "./constants";

const webhookReceivers: Record<string, WebhookReceiver> = {
"zapier.com": "zapier",
"hooks.zapier.com": "zapier",
"make.com": "make",
"hooks.slack.com": "slack",
Expand All @@ -22,8 +23,7 @@ export const isLinkLevelWebhook = (webhook: Pick<Webhook, "triggers">) => {
};

export const identifyWebhookReceiver = (url: string): WebhookReceiver => {
const urlObject = new URL(url);
const domain = urlObject.hostname;
const { hostname } = new URL(url);

return webhookReceivers[domain] || "user";
return webhookReceivers[hostname] || "user";
};

0 comments on commit fb36de4

Please sign in to comment.