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.

fix webhooks

Kiran Kf47c38180f2d
diff --git a/apps/web/lib/integrations/slack/transform.ts b/apps/web/lib/integrations/slack/transform.ts
index cafb2adb07..59fa30e267 100644
--- a/apps/web/lib/integrations/slack/transform.ts
+++ b/apps/web/lib/integrations/slack/transform.ts
@@ -1,3 +1,4 @@
+import { getBountyRewardDescription } from "@/lib/partners/get-bounty-reward-description";
import { APP_DOMAIN, currencyFormatter, truncate } from "@dub/utils";
import { LinkWebhookEvent } from "dub/models/components";
import { z } from "zod";
@@ -332,14 +333,27 @@ const bountyTemplates = ({
data: BountyEventWebhookPayload;
event: WebhookTrigger;
}) => {
- const { id, name, description, rewardAmount, type, startsAt, endsAt } = data;
+ const {
+ id,
+ name,
+ description,
+ rewardAmount,
+ rewardDescription,
+ type,
+ startsAt,
+ endsAt,
+ } = data;
const eventMessages = {
"bounty.created": "*New bounty created* :money_with_wings:",
"bounty.updated": "*Bounty updated* :memo:",
};
- const formattedReward = currencyFormatter(rewardAmount / 100);
+ const formattedReward = getBountyRewardDescription({
+ rewardAmount,
+ rewardDescription,
+ });
+
const linkToBounty = `${APP_DOMAIN}/program/bounties/${id}`;
return {
@@ -360,7 +374,7 @@ const bountyTemplates = ({
},
{
type: "mrkdwn",
- text: `*Reward Amount*\n${formattedReward}`,
+ text: `*Reward*\n${formattedReward}`,
},
],
},
diff --git a/apps/web/lib/webhook/sample-events/bounty-created.json b/apps/web/lib/webhook/sample-events/bounty-created.json
index f50e921832..d7cd8c52fb 100644
--- a/apps/web/lib/webhook/sample-events/bounty-created.json
+++ b/apps/web/lib/webhook/sample-events/bounty-created.json
@@ -6,6 +6,7 @@
"startsAt": "2025-08-01T17:34:00.000Z",
"endsAt": "2025-09-01T17:34:00.000Z",
"rewardAmount": 50000,
+ "rewardDescription": null,
"submissionRequirements": ["image", "url"],
"performanceCondition": null,
"groups": [
diff --git a/apps/web/lib/webhook/sample-events/bounty-updated.json b/apps/web/lib/webhook/sample-events/bounty-updated.json
index d216da994a..0b55e3678b 100644
--- a/apps/web/lib/webhook/sample-events/bounty-updated.json
+++ b/apps/web/lib/webhook/sample-events/bounty-updated.json
@@ -6,6 +6,7 @@
"startsAt": "2025-08-01T17:34:00.000Z",
"endsAt": "2025-09-01T17:34:00.000Z",
"rewardAmount": 100000,
+ "rewardDescription": null,
"submissionRequirements": ["image", "url"],
"performanceCondition": null,
"groups": [