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?
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.
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.
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!
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?
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.