APIs & Integrations

JHowardAdapt
Membro

Public object api merge endpoint undefined in Hubspot client

resolver

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 Solução aceita
JBeatty
Solução
Orientador(a) | Parceiro Diamante
Orientador(a) | Parceiro Diamante

Public object api merge endpoint undefined in Hubspot client

resolver

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

Exibir solução no post original

3 Respostas 3
JBeatty
Solução
Orientador(a) | Parceiro Diamante
Orientador(a) | Parceiro Diamante

Public object api merge endpoint undefined in Hubspot client

resolver

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
Gerente da Comunidade
Gerente da Comunidade

Public object api merge endpoint undefined in Hubspot client

resolver

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
Membro

Public object api merge endpoint undefined in Hubspot client

resolver

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