What is the Right Approach to Develop Custom Actions for the Hubspot App?

This topic was automatically generated from Slack. You can find the original thread here.

Hello, I am developing a custom action to update data on custom objects on hubspot. Basically I forked the code inside: pipedream/components/hubspot at master · PipedreamHQ/pipedream · GitHub removed the unnecessary code and files and changed the objects actions to achieve what I want.

The folder structure and everything else is pretty much the same and everything seems to be working except for the request to Hubspot which throws an auth error. I think that I’m missing something or doing something wrong. What is the right approach to build my own actions using the default hubspot app methods? Cause I think the problem is that I rebuild the _getHeaders and makeRequest methods and basically I’m not using the managed auth.

Hello , if you can share your code it would be a great help.

I would recommend you to read through Pipedream component API reference to understand how Pipedream component is capable of, especially the app props section, which manage your credentials.

Also Pipedream allow you to create your own action on the Workflow builder and share it across workflows. Would you mind read it through?

Last but not least, if you think Pipedream default hubspot action needed any improvement to support your usecase, feel free to submit us a ticket here: Sign in to GitHub · GitHub

Hi sure! This is the code that I’m using:
https://github.com/zpets/pipedream

Based on what you shared, maybe I just have to change the hubspot-custom.app.mjs to use the default app prop and default methods and leave the custom methods that I already implemented. But one thing that I’m not understanding and it’s not working is when I add the app prop to that hubspot-custom.app it’s throwing the following error:

— are you looking to use Pipedream’s OAuth client or your own?

If you’re not sure, no problem — happy to tell you more about what that means

I’m trying to use pipedreams OAuth

But the methods from the default hubspot app

You’ll need to make sure the hubspot app prop is in the app file, like here, since that is what enables access to all things auth

Yeah but it only exposes the $auth or all other methods too?

hubspot-custom.app.mjs is the file where I need the auth from Pipedream, but if I configure the hubspot prop like in the image below it throws the error that I sent in the message above in the terminal when I run the command pd dev action/get-pet/get-pet.mjs

Make sure the prop name and app attribute match (ie, based on what you’re saying, they should both be hubspot)

Instead of app: "hubspot-custom"

Same error:

Looks like you have lines 11 and 12 as dupes of 15 and 16

Oh, hang on, looking

Sorry, other way around — try removing 13-18

Now It build but says that $auth is undefined:

My mistake sorry, it worked! I added an extra hubspot, actually the auth credentials are under this.$auth…