APIs & Integrations

gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

I’m trying to use the UI to set up a webhook that will trigger on a change in the Deal Stage.

I have setup to monitor the following:

Object: Deal
Event: propertyChange
Property Name: Deal Stage

and also tried…

Object: Deal
Event: propertyChange
Property Name: dealstage

Neither is triggering when I drag a deal to a new stage or even if I open the deal manually and set the deal to a different stage.

Both subscriptions are active, and the “test” webhook works properly. I’m using Zapier if that matters to catch the hook.

Any idea what could cause them to not be triggered? How can I fix?

0 Upvotes
31 Replies 31
ErikOlson
Member

Using Webhook / Deal Property Changed - Deal Stage

I agree, please make this easier! I’m on my third day, I have the integration installed in a test portal, everything looks good, but it’s not posting to my webhook and I’m still trying to figure out why. This process is a series of frustrating puzzles. If you can’t make this easier, please show some source code like everyone else does!

I don’t understand why redirect_uri is hubspot.com. Why would ?code=xxx be sent to hubspot.com? How does this get ME the code that I need to get the access token? Wouldn’t the redirect_uri be my own page where I can use the code to get the access token?

gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

You can send the redirect back to your own server but it requires SSL so keep that in mind.

0 Upvotes
jacquesfu
Member

Using Webhook / Deal Property Changed - Deal Stage

thanks for all the assistance here I got this working, but holy smokes add a simple place to add their own webhooks for a portal… this is super common practice that shouldn’t require someone to go down the developer path

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

yep… confirmed. working now and triggering webhooks!

also, i was curious whether the Property change: value should be Deal Stage or dealstage and it looks like the dealstage is working correctly.

Deal Stage does not trigger.

i mention only b/c on your other post, you mention using Deal Stage which is not working (for me at least)

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

dealstage. It needs to be the internal name of the property for future reference. You can get the internal name under the settings for that object so deal settings in this case.

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

yep… got it!

thanks a ton for your help.

3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

I appreciate the research done on your part. Looks like I was incorrect in that post. I must have been spinning up a image quicker than I should have and didn’t take the proper time to think through what I was typing in the box as an example. My apologies and thank you for catching it.

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

hmmm… looks like it just worked… did u guys do something?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

No, I just went through the process myself to make sure it was working and I just got back a 200 with the access token and the refresh token. Do you see the install now?

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

confirmed… i’m getting them from here, right:

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

nope… same thing.

created a test portal, got the code, tried immediately.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

Even if you don’t get to the same grant screen you should still be able to choose which portal you want to generate the code for. I would double check to make sure your Client ID and secret are correct.

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

yes i just re-ran.

HOWEVER… remember i’m not getting the “grant access” button anymore b/c they are already authorized.

i will try with a fresh test portal and see if it works…

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

when i follow your instructions in postman, i get:

{
  "status": "INTERNAL_SERVER_ERROR",
  "message": "internal server error",
  "correlationId": "7ba33a03-2bfd-48b3-bff3-e88599d062f5",
  "requestId": "13d5669d0be72b36c221866de3ecfb45"
}

i tried it with several different code values from both live and test portals.

same result.

here are my postman settings:

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

Is that a fresh code you are using? I would try and run both steps, one right after the other. The only time i’ve ever received that error is when I have an old code as they expire.

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

i’m not sure i follow. i show zero installs, zero subscriptions, and zero events.

did you do something on the back-end that i’m missing?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

@cre I did not. I hit that first url to get the code and then I used the code to generate the install with the call i posted above in Postman.

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

ok so once i have the tokens… then what? how do i link up the hub_id and the email to the app?

i feel like i’m missing some small piece in here that is probably really simple.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Using Webhook / Deal Property Changed - Deal Stage

@cre It should be installed now! Please check your dev portal and see if the app was installed.

0 Upvotes
gotmike
Top Contributor

Using Webhook / Deal Property Changed - Deal Stage

i’m still not following how the nodeJS code and/or passport fit into the equation.

to be clear, i AM getting the “authorization” dialog when i use the URL indicated in the link you sent entitled “Initiate an Integration with Oauth 2.0”

let me see if i can explain better what’s happening.

you sent the following link: http://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration

on that link it says:

Sending a user to this URL will ask the user to approve access to contacts and workflows:
https://app.hubspot.com/oauth/authorize?client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&scope=contact...

If they grant access, the user would be redirected to this URL:
http://www.hubspot.com?code=xxxx

If there are any problems with the authorization, you’ll get the error parameters instead of the code:
http://www.hubspot.com?error=error_code&error_description=Human%20readable%20description%20of%20the%...

okay, so here’s what i do…

i created a link similar to the first one shown in the instructions. it looks like this: https://app.hubspot.com/oauth/authorize?client_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&scope=contact...

when i go to that link in a browser, i get:

seems like it’s working…

after i click “grant access” i get this page:

this has my token code.

now, if i go back and try to re-authorize, by going to the original URL, i get this:

and then this… (via redirect)

so this tells me that i have already authorized the app for this portal.

if i create a new portal, then i have to start all over again, but once it’s been authorized, i never get the “grant access” button again for the same app in the same portal. as i have mentioned before, i still don’t see how to “revoke access” once it’s been granted.

either way, when i go back to the developer portal, i’m still not seeing any installs.

so again, i’m not following what on earth the nodeJS code does for me.

the only line of code that seems to do anything is this one:
User.findOrCreate({ email: json_response.user, hub_id:json_response.hub_id, access_token:accessToken, refresh_token: refreshToken }, function (err, user,created) { return done(err, user); }

i don’t see any documentation on the hubspot api page referencing the User.findOrCreate function either.

i’m guessing that this is some internal function that somehow adds the email address of the USER into the APP somehow and pairs them up in some way.

if that’s the case, isn’t there some REST URL i can use instead of trying to implement this nodeJS code? or maybe send it back to hubspot using postman or something like that?

if i try to hit this URL using postman with a GET: https://api.hubapi.com/oauth/v1/access-tokens/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX (using the token received above)

then i get the following response…

{
  "status": "error",
  "message": "The access token must have the correct format",
  "correlationId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "requestId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

if i then try to use POST via postman on the same URL, but attempt to populate the JSON and send as a RAW Body, something like this:

{
"email":"my@email.com",
"hub_id":"test-portal-hub-id",
"access_token":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"refresh_token":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}

i get an error back: 405 Method Not Allowed

perhaps you could share with me how to implement this via postman using a REST API call instead of using nodeJS and passport?

it seems like i’m missing one small piece here in the middle of this to add the hub_id and the email to the app somehow.

0 Upvotes