Skip to content

Commit cbc42a3

Browse files
committed
fix(hubspot): switch marketing events to CRM Objects API and add HubSpotCrmObject base type
1 parent 7694878 commit cbc42a3

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

apps/sim/tools/hubspot/get_marketing_event.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const hubspotGetMarketingEventTool: ToolConfig<
3939

4040
request: {
4141
url: (params) =>
42-
`https://api.hubapi.com/marketing/v3/marketing-events/${params.eventId.trim()}`,
42+
`https://api.hubapi.com/crm/v3/objects/marketing_events/${params.eventId.trim()}`,
4343
method: 'GET',
4444
headers: (params) => {
4545
if (!params.accessToken) {
@@ -62,7 +62,7 @@ export const hubspotGetMarketingEventTool: ToolConfig<
6262
success: true,
6363
output: {
6464
event: data,
65-
eventId: data.objectId ?? data.id,
65+
eventId: data.id,
6666
success: true,
6767
},
6868
}

apps/sim/tools/hubspot/list_marketing_events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const hubspotListMarketingEventsTool: ToolConfig<
4949

5050
request: {
5151
url: (params) => {
52-
const baseUrl = 'https://api.hubapi.com/marketing/v3/marketing-events'
52+
const baseUrl = 'https://api.hubapi.com/crm/v3/objects/marketing_events'
5353
const queryParams = new URLSearchParams()
5454
if (params.limit) queryParams.append('limit', params.limit)
5555
if (params.after) queryParams.append('after', params.after)

apps/sim/tools/hubspot/types.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ export interface HubSpotUser {
706706
superAdmin?: boolean
707707
}
708708

709-
export interface HubSpotContact {
709+
export interface HubSpotCrmObject {
710710
id: string
711711
properties: Record<string, any>
712712
createdAt: string
@@ -715,6 +715,9 @@ export interface HubSpotContact {
715715
associations?: Record<string, any>
716716
}
717717

718+
/** @deprecated Use HubSpotCrmObject instead */
719+
export type HubSpotContact = HubSpotCrmObject
720+
718721
export interface HubSpotPaging {
719722
next?: {
720723
after: string
@@ -845,7 +848,7 @@ export interface HubSpotSearchContactsParams {
845848
}
846849

847850
// Companies (same structure as contacts)
848-
export type HubSpotCompany = HubSpotContact
851+
export type HubSpotCompany = HubSpotCrmObject
849852
export type HubSpotListCompaniesParams = HubSpotListContactsParams
850853
export type HubSpotListCompaniesResponse = Omit<HubSpotListContactsResponse, 'output'> & {
851854
output: {
@@ -897,7 +900,7 @@ export interface HubSpotSearchCompaniesResponse extends ToolResponse {
897900
}
898901

899902
// Deals
900-
export type HubSpotDeal = HubSpotContact
903+
export type HubSpotDeal = HubSpotCrmObject
901904
export type HubSpotListDealsParams = HubSpotListContactsParams
902905
export type HubSpotListDealsResponse = Omit<HubSpotListContactsResponse, 'output'> & {
903906
output: {
@@ -933,7 +936,7 @@ export interface HubSpotSearchDealsResponse extends ToolResponse {
933936
}
934937

935938
// Tickets
936-
export type HubSpotTicket = HubSpotContact
939+
export type HubSpotTicket = HubSpotCrmObject
937940
export type HubSpotListTicketsParams = HubSpotListContactsParams
938941
export type HubSpotListTicketsResponse = ToolResponse & {
939942
output: {
@@ -971,7 +974,7 @@ export interface HubSpotSearchTicketsResponse extends ToolResponse {
971974
}
972975

973976
// Line Items
974-
export type HubSpotLineItem = HubSpotContact
977+
export type HubSpotLineItem = HubSpotCrmObject
975978
export type HubSpotListLineItemsParams = HubSpotListContactsParams
976979
export type HubSpotListLineItemsResponse = ToolResponse & {
977980
output: {
@@ -999,7 +1002,7 @@ export type HubSpotUpdateLineItemResponse = ToolResponse & {
9991002
}
10001003

10011004
// Quotes
1002-
export type HubSpotQuote = HubSpotContact
1005+
export type HubSpotQuote = HubSpotCrmObject
10031006
export type HubSpotListQuotesParams = HubSpotListContactsParams
10041007
export type HubSpotListQuotesResponse = ToolResponse & {
10051008
output: {
@@ -1017,7 +1020,7 @@ export type HubSpotGetQuoteResponse = ToolResponse & {
10171020
}
10181021

10191022
// Appointments
1020-
export type HubSpotAppointment = HubSpotContact
1023+
export type HubSpotAppointment = HubSpotCrmObject
10211024
export type HubSpotListAppointmentsParams = HubSpotListContactsParams
10221025
export type HubSpotListAppointmentsResponse = ToolResponse & {
10231026
output: {
@@ -1045,7 +1048,7 @@ export type HubSpotUpdateAppointmentResponse = ToolResponse & {
10451048
}
10461049

10471050
// Carts
1048-
export type HubSpotCart = HubSpotContact
1051+
export type HubSpotCart = HubSpotCrmObject
10491052
export type HubSpotListCartsParams = HubSpotListContactsParams
10501053
export type HubSpotListCartsResponse = ToolResponse & {
10511054
output: {

0 commit comments

Comments
 (0)