APIs & Integrations

integrate_hubsp
Member

Install an App from hubspot into clients hubspot account

]
I’m struggling to understand how all this fits together. I’ve created a developer account and an app. I have the app hooked up with webhooks… but how do I install the app on my clients HubSpot account?

Also, how do I add a button to make my app do something?

thanks!

0 Upvotes
7 Replies 7
gotmike
Top Contributor

Install an App from hubspot into clients hubspot account

sure thing.

i think engineering did a good job designing the functionality, it’s just not clear how to “hack” an individual app and account together.

it seems to me like you probably have a lot of users who are doing exactly this, and b/c of that a streamlined solution is good to have.

i don’t think the “code” thing is standard on other OAuth platforms, though. usually you get the token(s) and then use them for future access.

here, remember, we are calling this an “app” but that’s not really what we (@integrate_hubspot and i) are trying to accomplish. we literally ONLY need the webhooks. we are never using tokens to re-establish inbound contact to the app again. we just want to setup the outbound webhooks from hubspot.

i think that’s where the confusion probably lies. your folks have lumped together the webhook functionality into apps, and i’m not saying it’s bad or wrong, it’s just different. i haven’t seen another system require OAuth to initiate an outbound webhook from an internal system before. usually that’s just a setting in the primary application. like i would expect it to be in my normal hubspot settings->integrations menu. other systems like mailchimp, campaign monitor, unbounce, etc… all allow you to setup webhooks directly in the UI.

again, it is an interesting feature, but i kindof think it belongs in both places really. as a user, i’d like to setup a webhook for my own use in my UI without having to create an app or call a developer. but as a developer, there are also uses to being able to attach webhooks to my app as well.

in this case, i believe both myself and @integrate_hubspot are acting more like end users than developers trying to create scalable solutions for publishing to the broad universe of hubspot users.

0 Upvotes
gotmike
Top Contributor

Install an App from hubspot into clients hubspot account

@integrate_hubspot - Scott I can help clarify a bit. I think the engineers that built this didn’t do a good job explaining how it works, so hopefully I can translate b/c I had to go through it to get the webhooks to work. Rest assured, once they work, they make your life substantially easier. Prior to this we had to poll the HubSpot API constantly and update a local DB then run triggers off that DB. It was a royal pain. Since transitioning to the webhooks, life has gotten substantially easier.

The key they don’t tell you is the “code” part at the end. After you do the Oauth 2.0 thing, you will get a redirect back to HubSpot that looks like this…

https://discourse-cdn-sjc1.com/hubspot/uploads/default/efda1b4f2fc7bfd7cbe2e44558aef2cf52153648

The part that’s not entirely clear is that the “code” given here is actually what “pairs” your app and the client id on the back-end. So, what you do is send that code back to the system by requesting a new set of tokens. It is important to note that if you are only doing webhooks, you don’t even need the tokens in the first place, you just need to request them to link up the hubspot id with the app in the back-end by using the code.

so send the required parameters as outlined here: http://developers.hubspot.com/docs/methods/oauth2/get-access-and-refresh-tokens

In essence, THIS is the “install” process (as I understand it) but it’s not made clear anywhere that it’s what’s happening.

I believe there are other ways to do this, like the NodeJS thing but if you are just doing for a single client (or yourself), then this manual process should work fine.

As far as the token “duration” I don’t believe that even matters as far as the webhooks are concerned. Again, you don’t really need the tokens, it’s just coincidental that generating the tokens also links up the hubspot id and the app.

What I have NOT yet figured out is how to REVOKE permissions or UNINSTALL an app. So once the app has access and it’s installed, I believe it is permanent.

0 Upvotes
integrate_hubsp
Member

Install an App from hubspot into clients hubspot account

WOW! Thanks so much for the write up… I FINALLY got it with your help! I basically beat the code into submission.

To uninstall… Not sure if this is what you’re after. Go to upper right drop down by your company name. Then choose “integrations” - you should see your integration and an option to uninstall. Hope that’s what you needed.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Install an App from hubspot into clients hubspot account

@cre Thank you for helping to clarify. I will reach out to our engineering team to see if they can expand on the documentation to make it easier for people to use. Now that you guys have got it working the good thing is this process is not a HubSpot specific process and how OAuth works anywhere so you can carry this knowledge into other platforms.

I really appreciate the write up cre.

0 Upvotes
integrate_hubsp
Member

Install an App from hubspot into clients hubspot account

Thanks for the reply. So is the only way to “install” the app is to use OAuth? That is, I can’t use hapikey?

If I “force” OAuth and get a token, how long is the token good for?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Install an App from hubspot into clients hubspot account

once it’s installed, it’s installed.

But as a side note token is good for around 6-8 hours.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Install an App from hubspot into clients hubspot account

@integrate_hubspot
You need to install in into your portal. Here is a forum post for reference. Your app listens for changes and then fires off web hooks. You shouldn’t need a button to do anything.

0 Upvotes