APIs & Integrations

caiorochap
Participant

Webhooks not triggering when deal is deleted

SOLVE

Hi everyone.
I've created an app so I can subscribe to the deal deletion event. I've been checking, the response I send to my endpoint is always 200 and the subscription is active. However, my database, which should have the records deleted once the event is triggered, has around 5000 records and a full request on the get all deals API returns 4945 records. Also, the monitoring tab on the app shows me no webhook was triggered. Can anyone tell me what could be the problem here?

0 Upvotes
1 Accepted solution
Derek_Gervais
Solution
HubSpot Alumni
HubSpot Alumni

Webhooks not triggering when deal is deleted

SOLVE

Hey @caiorochap ,

 

It sounds like you've configured the webhook details in your developer account, but have you completed the OAuth process for your test/production account? Webhook notifications will only be sent when the app is "installed" to a portal. Specifically, the OAuth authorization flow must be completed & refresh/access tokens must be obtained. This is required even if your app isn't doing anything except listening to webhook notificaitons.

View solution in original post

6 Replies 6
Derek_Gervais
Solution
HubSpot Alumni
HubSpot Alumni

Webhooks not triggering when deal is deleted

SOLVE

Hey @caiorochap ,

 

It sounds like you've configured the webhook details in your developer account, but have you completed the OAuth process for your test/production account? Webhook notifications will only be sent when the app is "installed" to a portal. Specifically, the OAuth authorization flow must be completed & refresh/access tokens must be obtained. This is required even if your app isn't doing anything except listening to webhook notificaitons.

caiorochap
Participant

Webhooks not triggering when deal is deleted

SOLVE

hey, @Derek_Gervais.

Could you give me some help here? 

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Webhooks not triggering when deal is deleted

SOLVE

Hey @caiorochap ,

 

Generating accesss/refresh tokens is what completes the authentication process, which activates webhook notifications and causes the app to appear in the "Connected Apps" page, among other things. This is an artifact of how HubSpot's OAuth implementation was originally designed; the access token expiration doesn't have any bearing on your webhook subscriptions.

 

I can totally understand how this feels weird, since you're only interested in using webhooks. I'm happy to pass your feedback along to my team to take into account as we continue to improve the OAuth process!

xmabrielos
Member

Webhooks not triggering when deal is deleted

SOLVE

Hello Derek,

Thank you for the support.

Should the token be refreshed each time or just the first time?

0 Upvotes
caiorochap
Participant

Webhooks not triggering when deal is deleted

SOLVE

Hi, @Derek_Gervais,

That is the problem indeed. However, the documentation is quite confusing. If I'm just building a webhook listener, why would I have to authenticate an user? What could simply solve the problem here?

0 Upvotes
caiorochap
Participant

Webhooks not triggering when deal is deleted

SOLVE

Also, the tokens expire after every six hours. How would this affect my app? I'd have to refresh it manually or create a job to refresh it? Or would it be necessary only once? I'm confused. 

0 Upvotes