Multiple webhook requests with the same payload except attemptNumber
I created an app with Webhook that subscribes for "contact.creation" event. Everything is working fine for about 4 months but in the past few days, my server endpoint has been receiving duplicate event payloads for the same objectId, eventId, subscriptionType and occurredAt. I noticed that the attemptNumber is increasing from 0 to 9. So it looks like HubSpot is doing multiple attempts to send the same "contact.creation" event for the same lead. Everything in the payload is the same except the "attemptNumber".
Multiple webhook requests with the same payload except attemptNumber
The weird thing is I only encountered this issue recently and never before in that 4 months span. If HubSpot was timing out the webhook requests due to the delay I added, then I should have encountered this issue 4 months ago. Why only now?
Btw, I have fixed this issue by doing an asynchronous call to the Contacts API and then returning the Hubspot Webhook request right away without waiting for the Contact API request to finish.
But I'm still curious why suddently Hubspot was timing out the webhook requests only recently.
Multiple webhook requests with the same payload except attemptNumber
Thanks @dennisedson. To add, even if the timeouts were happening recently, it appeared to be random. Some requests were working fine and some not. I couldn't find any pattern why those failed requests were failing.
Multiple webhook requests with the same payload except attemptNumber
I think I found the root cause of the issue. My Webhook endpoint takes about 10 seconds to finish. I think HubSpot has a timeout of 5 seconds? My webhook takes that long because I'm setting a delay of 7 seconds to wait for HubSpot to populate the hs_analytics_source_data_1 and hs_analytics_source_data_2 properties before I call the Contacts API after retrieving the objectId from the webhook request. WIthout the delay, those 2 properties are empty. Please see my thread that I posted 4 months ago about this delay.
Multiple webhook requests with the same payload except attemptNumber
It happens on multiple contacts. When I checked the Webhooks Monitoring, it shows the requests failed but without HTTP status code. It just shows "Failure" in the Webhook event details. I checked the logs on my server but didn't find any related errors.