APIs & Integrations

GMcCarthy7
Participant

Responding to a deal change webhook

SOLVE

Hi,

 

I am trying to create an integration that will respond to changes in the "Deal Probability" property and I would like to check my understanding:

 

1) Create a webhook subscription for the Deal object Properties changed. A public app is required for a webhook subscription, so I must create a public app.

2) The webhook only states that the Deal has changed, so I must call back to the HS API to get all information about the changes to the Deal specified in the webhook.

3) To call back to the API, an active OAuth connection is required.

4) If the  OAuth token is not refreshed on time then the user will have to redo the authorisation process to create a new token/refresh token. So for this to work as an automated process the OAuth refresh token must always be used before the expiry time

 

Is that all correct? Are there any steps that can be simplified?

 

Thanks.

1 Accepted solution
JBeatty
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Responding to a deal change webhook

SOLVE

Hi @GMcCarthy7,

 

If building a private integration, you will only need to connect the oauth application once. If the token expires the webhooks will continue to send. So a simpler solution would be the following:

  1. Set up an oauth application with a deal read scope, and a webhook for the properties you want
  2. Set the webhook URL to a server somewhere
  3. Connect the oauth application with a localhost redirect, and a localhsot oauth server
  4. The server will not be recieving webhooks and could make API calls via a private app

The oauth token can be completely disregarded at this point(for the rest of time) and as long as no one manually disconnects the app from the portal, the webhooks will continue to send.

 

If you are building a public integration then you are mostly correct, other than the need to refresh the token, that can be done a week or two later whenever you need to make an API call using the token. That whole week or two webhooks will continue to send.

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

View solution in original post

4 Replies 4
JBeatty
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Responding to a deal change webhook

SOLVE

Hi @GMcCarthy7,

 

If building a private integration, you will only need to connect the oauth application once. If the token expires the webhooks will continue to send. So a simpler solution would be the following:

  1. Set up an oauth application with a deal read scope, and a webhook for the properties you want
  2. Set the webhook URL to a server somewhere
  3. Connect the oauth application with a localhost redirect, and a localhsot oauth server
  4. The server will not be recieving webhooks and could make API calls via a private app

The oauth token can be completely disregarded at this point(for the rest of time) and as long as no one manually disconnects the app from the portal, the webhooks will continue to send.

 

If you are building a public integration then you are mostly correct, other than the need to refresh the token, that can be done a week or two later whenever you need to make an API call using the token. That whole week or two webhooks will continue to send.

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
Community Manager
Community Manager

Responding to a deal change webhook

SOLVE

Thank you, @JBeatty 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
GMcCarthy7
Participant

Responding to a deal change webhook

SOLVE

That's great, thanks for your help.

Jaycee_Lewis
Community Manager
Community Manager

Responding to a deal change webhook

SOLVE

Hi, @GMcCarthy7 👋 @Teun @LMeert @JBeatty, any thoughts for @GMcCarthy7?

 

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot