Jul 7, 2017 10:04 PM
I’m having problems with endless multiple duplicates when I set up a webhook subscription in the developer app.
I am getting endless duplicates of execution of my code in my webhook endpoint, even though it has successfully completed the task eg. create contact or create invoice.
Here’s my setup:
In the configuration I’ve set it for HubSpot to be allowed to send 5 concurrent requests (minimum of 5).
In my webhook subscription
Event: Property change: dealstage
My code checks to see if the dealstage is closedwon and then executes my code eg to create a contact in the receiving application.
HubSpot executes the code the first time successfully however the webhook log is showing a Status Failture and Request time out response. The first line of my code is sending back an http 200 ok response (I’ve tried both http_response_code(200); and header(“HTTP/1.1 200 OK”); in php). But HubSpot doesn’t seem to be recognising these response codes.
HubSpot continues it seems indefinitely to send the json data to the webhook enpoint which is creating endless duplicates in the receiving applications.
The only way for me to stop it seems to be to pause the subscription and then start it again.
Is there a ‘correct’ way to let HubSpot know that I have successfully executed the code? What am I doing wrong?
Jul 10, 2017 9:38 AM
@Getudigital There isn’t a way to notify HubSpot that your application is done. A webhook will fire off the JSON whenever a deal stage is updated. Are you receiving the same deal each time with the same moving deal stage? Are you updating the deal stage your self in your code or are the users doing so in the UI?
Jul 22, 2017 5:08 AM
Sincere apologies for the delayed reply and thanks for getting back to me. Regarding your comments/questions (my replies in bold):
A webhook will fire off the JSON whenever a deal stage is updated. Yes, I understand that but it is firing the JSON up to 10 times per single instance of the deal stage being updated in the UI
Are you receiving the same deal each time with the same moving deal stage? Yes
Are you updating the deal stage your self in your code or are the users doing so in the UI? The user is doing it in the UI
**When I look at the webhook logging in the developer app, it consistently says Status Failed for each time the JSON is fired off, even though my file has received and processed the JSON data. But there are some (what seem to be) random exceptions where the HTTP column has 200 in it and the Status is Success. But these exceptions only seem to be on JSON data that isn’t processed by my file because it doesn’t meet the “dealstage = closedwon” rule in my code.
I’m managing to get around it for now by checking for duplicates in my code, but it can’t be helping performance or my daily api limit. For now this isn’t posing a problem but at some stage it will.
Thanks in advance for your help **
Aug 1, 2017 2:51 AM
Sorry to be so long replying again, I’ve been dealing with some other coding challenges lol!
Here’s the link to the deal as requested: https://app.hubspot.com/contacts/2225255/deal/168120076/
And here’s the link to the webhook logging for this particular example: https://app.hubspot.com/developers-alpha/2475967/application/51594/monitoring/webhooks
If you look at batch id 323f64cd you can see that it returned a 200 http response (which is rare when the deal is closed won but happens more often when it is changed to another deal stage). Then compare that with batch id 7e7ff1a0 that is attempt number 7 for the same deal but with different title and amount. An earlier attempt was successful at processing that change but it is still going at least 7 attempts later.
What am I doing wrong?
Thanks in advance,
Aug 1, 2017 11:54 AM
There seems to be a lot of timeouts being registered that is causing the retry attempts. I would at first think you are not responding to the calls at all but it seems that you are. Do you have any logging on your end? Are you logging the same number of calls? I also see some calls that were responded to with 500s. Are you sending those back under certain circumstances?
Sep 2, 2017 5:37 AM
@pmanca, thanks for your questions and prompts. I figured it might have had something to do with the timeouts and it turns out it was. I migrated to a faster responding server and I don’t seem to have the issues as often these days. For now, I’ll park this and let you know if I have further issues. Thanks again!