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.

add axiom to singular webhook, fix description

Steven Teyb01965d13131
diff --git a/apps/web/app/(ee)/api/singular/webhook/route.ts b/apps/web/app/(ee)/api/singular/webhook/route.ts
index f7b6af4db9..8fc64e4f04 100644
--- a/apps/web/app/(ee)/api/singular/webhook/route.ts
+++ b/apps/web/app/(ee)/api/singular/webhook/route.ts
@@ -4,6 +4,7 @@ import { trackSingularLeadEvent } from "@/lib/integrations/singular/track-lead";
import { trackSingularSaleEvent } from "@/lib/integrations/singular/track-sale";
import { prisma } from "@dub/prisma";
import { getSearchParams } from "@dub/utils";
+import { AxiomRequest, withAxiom } from "next-axiom";
import { NextResponse } from "next/server";
import { z } from "zod";
@@ -36,7 +37,7 @@ const authSchema = z.object({
const singularWebhookToken = process.env.SINGULAR_WEBHOOK_TOKEN;
// GET /api/singular/webhook – listen to Postback events from Singular
-export const GET = async (req: Request) => {
+export const GET = withAxiom(async (req: AxiomRequest) => {
try {
if (!singularWebhookToken) {
throw new DubApiError({
@@ -114,8 +115,8 @@ export const GET = async (req: Request) => {
} catch (error) {
return handleAndReturnErrorResponse(error);
}
-};
+});
-export const HEAD = async () => {
+export const HEAD = () => {
return new Response("OK");
};
diff --git a/apps/web/lib/integrations/slack/transform.ts b/apps/web/lib/integrations/slack/transform.ts
index 0a66ac3313..6d97f61b56 100644
--- a/apps/web/lib/integrations/slack/transform.ts
+++ b/apps/web/lib/integrations/slack/transform.ts
@@ -1,4 +1,4 @@
-import { APP_DOMAIN, currencyFormatter } from "@dub/utils";
+import { APP_DOMAIN, currencyFormatter, truncate } from "@dub/utils";
import { LinkWebhookEvent } from "dub/models/components";
import { z } from "zod";
import { WebhookTrigger } from "../../types";
@@ -346,7 +346,7 @@ const bountyTemplates = ({
fields: [
{
type: "mrkdwn",
- text: `*Bounty Name*\n${name || "Untitled Bounty"}`,
+ text: `*Bounty Name*\n${truncate(name, 140) || "Untitled Bounty"}`,
},
{
type: "mrkdwn",
@@ -373,7 +373,7 @@ const bountyTemplates = ({
type: "section",
text: {
type: "mrkdwn",
- text: `*Description*\n${description}`,
+ text: `*Description*\n${truncate(description, 140)}`,
},
},
]