APIs & Integrations

JHowardAdapt
メンバー

Public object api merge endpoint undefined in Hubspot client

解決

Hi,

I am trying to access the new merge endpoint found here from the Hubspot client within a custom code block of a Hubspot workflow but I get this error: 

 

"TypeError: Cannot read property 'merge' of undefined"

 

I used the Nodejs example from the docs.

 

It looks like the publicObjectApi isn't accessible in the hubspot client? 

I am wondering if this is maybe because it's a relatively new endpoint? 

 

Any help would be great.

 

1件の承認済みベストアンサー
JBeatty
解決策
ガイド役 | Diamond Partner
ガイド役 | Diamond Partner

Public object api merge endpoint undefined in Hubspot client

解決

Hi @JHowardAdapt,

 

Inside of a custom code action the included hubspot api client is version 3.4.1. The PublicObjectApi was added in version 6.0.1.

If you want to access this endpoint I would recommend using an http client like axios or request, and just manually calling the api: "/crm/v3/objects/{objectType}/merge". Or if you absolutely must use the HubSpot client you can set up a build system and manually build in the correct version of the client using someting like esbuild. I would not recommend doing this though as it makes your custom code unreadable and quite large to someone without access to the original code.

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

元の投稿で解決策を見る

3件の返信
JBeatty
解決策
ガイド役 | Diamond Partner
ガイド役 | Diamond Partner

Public object api merge endpoint undefined in Hubspot client

解決

Hi @JHowardAdapt,

 

Inside of a custom code action the included hubspot api client is version 3.4.1. The PublicObjectApi was added in version 6.0.1.

If you want to access this endpoint I would recommend using an http client like axios or request, and just manually calling the api: "/crm/v3/objects/{objectType}/merge". Or if you absolutely must use the HubSpot client you can set up a build system and manually build in the correct version of the client using someting like esbuild. I would not recommend doing this though as it makes your custom code unreadable and quite large to someone without access to the original code.

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

Jaycee_Lewis
コミュニティーマネージャー
コミュニティーマネージャー

Public object api merge endpoint undefined in Hubspot client

解決

Hey, @JHowardAdapt. It looks like @LMeert had some insight on your original post here@JBeatty @Kevin-C, do you have any thoughts on using this in a workflow custom coded action?

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

JHowardAdapt
メンバー

Public object api merge endpoint undefined in Hubspot client

解決

I tried using the example give from the docs as suggested but it throws an undefined error at the point of publicObjectApi.merge. 

The exact same code works fine outside of custom code blocks, in a standard .js file. 

Whereas within the custom code block it can't seem to find the merge endpoint from the huspotclient import