Engagements endpoint change?

Regular Contributor

Has there been any change to the engagements endpoint in the last 24 hours or so? My integration has been working fine putting notes in contact records for over 12 months and all of a sudden I'm getting 400 Bad Request in response to my curl script. My oauth is working fine as I'm getting data from the contacts endpoint just prior to the engagements one firing.

Just wondered if something might have changed recently? Is anyone else having issues?

9 Replies 9
Regular Contributor

Same problem here, getting bad requests error messages all over my integrations.

Even a simple create deal using Zapier official Hubspot CRM integration stopped working:

Looks likes some issue related with array fields (associated contacts, associated deals, etc...)

To simulate the problem on Zapier:

1 - Create a Zapier with some trigger (in my case I used Zapier Push)
2 - Create a second step Hubspot CRM > Create Deal
3 - On edit template, specify fields like deal name, deal stage, etc. Important is to include an associated contact to simulate the error, like the screenshot above.
4 - Try to test this step, it will genarete an error:
"We had trouble sending your test through. Please try again. Error: api.hubapi.com returned (400) Bad Request and said "Invalid input JSON on line 1, column 36: Invalid JSON input: Can not deserialize instance of LONG out of START_ARRAY token at line 1, column 36""

This is just an example, it is generating different error messages all over my integration that has any associated field (array).

I kindly request Hubspot API dev guys to take a look on this.

New Contributor

We're experiencing exactly the same bug. Would be great to receive a prompt response.

Not applicable

We are also experiencing the same issue in Zapier with the Creat Deal action.

We have changed nothing, but jobs started failing yesterday PM. An update would be apreciated.

Regular Contributor

I just received an update from Zapier team that they are already working on a solution with HS:

Sorry to hear that you've been having a hassle with your Zaps - that's definitely not the experience we want you to have! It looks like you're being hit by a bug that just surfaced on Hubspot CRM where creating a deal that also has an associated contact is not working. My apologies, I know this can be frustrating. I've gone ahead and added you to the list of people who are being affected by this while we work on resolving it with their team. I can't give an ETA on when this will be fixed, but it's being researched and once it's resolved we'll definitely let you know.

Hope they solve all the API issues for all ASAP.

An update from Hubspot would still be very appreciated.

Community Manager

Hi all,

It's tough to say for sure that every report here is related, but I can definitely speak to all of the Zapier related issues. There was a JSON formatting bug that affected the Zapier integration; this bug has since been fixed, and should no longer be occurring for Zapier integrated portals. If anyone is still encountering errors, then it's a separate issue that I'd be happy to troubleshoot.

Regular Contributor

Thank you @Derek_Gervais, I can confirm that reported Zapier related issue on creating a deal is now fixed.

But still having issues on create engagement using API: Every time I try to create an engagement with an associated contact ou deal it take me the following error:

"api.hubapi.com returned (400) Bad Request and said "Invalid input JSON on line 1, column 33: Invalid JSON input: Expected JSON array for repeated field com.hubspot.engagements.base.Associations.contact_ids at line 1, column 33"

It was working on the past months probably you've solved this issue on created a deal but it is still on create an engagement end.

My guess is that that @SAlford has this issue to as he reported engagement related issue too.

Regular Contributor

Hi all,

After hours of troubleshooting I fixed my issue. For context, I’m using php. In my array for the engagement curl post fields I had one value which was $arr["associations"]["contactIds"] = $vid; which was the vid of the associated contact.

I changed this to $arr["associations"]["contactIds"] = [$vid]; (ie. added the square brackets around $vid) and it fixed my problem. I’m not enough of a developer to understand why this fixed the problem, but it worked and I was able to resend my 4,000 odd engagement notes like magic as always.

I have no idea why this would have changed after working seamlessly for 7 months but in any case, this resolved the issue for me and I hope it helps someone else.

Community Manager

Hi @SAlford & @Gravity,

The information you provided @SAlford is actually extremely relevant. contactIds is an array of vids representing the contact records associated with the engagement. The earlier code:

  $arr["associations"]["contactIds"] = $vid;

Was setting contactIds to a single value, while your new code:

$arr["associations"]["contactIds"] = [$vid];

Properly sets contactIds to an array with a single value. I'm not sure why the old code was working before, since that should never have passed HubSpot's JSON validation. Regardless, my apologies for the sudden shift in behavior. Going forward, you'll want to make sure that you're passing arrays for any fields that are supposed to be arrays.

Regular Contributor

Hi @Derek_Gervais,

thank you so much for taking the time to explain why my change worked and what to do moving forward. I also have no idea why it worked for so long previously, but either way I'm happy it's working now and glad to have learned something. I'll do more study to understand more about passing arrays as it is definitely an area I could use a better understanding of.

Thanks again, I appreciate your response.