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.

Update HubSpot integration schema

Kiran Kc2ad91b4c5ba
diff --git a/apps/web/lib/integrations/hubspot/schema.ts b/apps/web/lib/integrations/hubspot/schema.ts
index 372c2d12a7..a49f89030b 100644
--- a/apps/web/lib/integrations/hubspot/schema.ts
+++ b/apps/web/lib/integrations/hubspot/schema.ts
@@ -1,5 +1,8 @@
import z from "@/lib/zod";
-import { HUBSPOT_OBJECT_TYPE_IDS } from "./constants";
+import {
+ HUBSPOT_DEFAULT_CLOSED_WON_DEAL_STAGE_ID,
+ HUBSPOT_OBJECT_TYPE_IDS,
+} from "./constants";
// Authentication
export const hubSpotAuthTokenSchema = z.object({
@@ -13,9 +16,23 @@ export const hubSpotAuthTokenSchema = z.object({
// Integration settings
export const hubSpotSettingsSchema = z.object({
+ leadTriggerEvent: z
+ .enum(["lifecycleStageReached", "dealCreated"])
+ .nullish()
+ .default("dealCreated")
+ .describe(
+ "Indicates which event should trigger the final lead tracking for the contact.",
+ ),
+ leadLifecycleStageId: z
+ .string()
+ .nullish()
+ .describe(
+ "The ID of the contact lifecycle stage that represents a lead. Applicable only if leadTrackingTrigger is 'lifecycleStageReached'.",
+ ),
closedWonDealStageId: z
.string()
.nullish()
+ .default(HUBSPOT_DEFAULT_CLOSED_WON_DEAL_STAGE_ID)
.describe("The ID of the deal stage that represents a closed won deal."),
});
@@ -67,6 +84,6 @@ export const hubSpotLeadEventSchema = z.object({
export const hubSpotSaleEventSchema = z.object({
objectId: z.number(),
subscriptionType: z.literal("object.propertyChange"),
- propertyName: z.literal("dealstage"),
- propertyValue: z.string(), // eg: closedwon
+ propertyName: z.enum(["lifecyclestage", "dealstage"]),
+ propertyValue: z.string(),
});
diff --git a/apps/web/scripts/create-integration.ts b/apps/web/scripts/create-integration.ts
index 915d97400d..d97c226e9b 100644
--- a/apps/web/scripts/create-integration.ts
+++ b/apps/web/scripts/create-integration.ts
@@ -7,9 +7,9 @@ async function main() {
const integration = await prisma.integration.create({
data: {
id: createId({ prefix: "int_" }),
- name: "Slack",
- slug: "slack",
- description: "Slack",
+ name: "Hubspot",
+ slug: "hubspot",
+ description: "Hubspot",
developer: "Dub",
website: "https://dub.co",
verified: true,