APIs & Integrations

Christopher_Pep
Member

Integration 412 error

Support asked me to post this here.

We have a workato recipe that enrolls users that download our products into an email campaign in hubspot. It has started to throw a 412 error that seems to originate from you. Its possible that the 412 is generated by workato when receiving the 204 response from you.

An example from today given input:

{
Method: POST,
Encoding: UTF-8,
Response content type: json,
Request name: Enroll contact in workflow - Download TK4J from Marketplace,
Request URL: https://api.hubapi.com/automation/v2/workflows//enrollments/contacts/?hapikey=
}

yields error:

HTTP error: #<RestClient::PreconditionFailed: 412 Precondition Failed>

If I manually POST to that url via postman I get an error suggesting that the original operation succeeded.

{
"status": "error",
"message": "Contact has already been enrolled in the workflow. Change the workflow setting if you want to allow multiple enrollments of the same contacts.",
"correlationId": "",
"type": "NOT_ALLOWED_TO_REPEAT",
"requestId": ""
}

Hubspot enroll URL returns a "204 No Content" when it is successful and perhaps that is what is confusing workato.

0 Upvotes
7 Replies 7
IsaacTakushi
HubSpot Employee
HubSpot Employee

Integration 412 error

Hey, @Christopher_Pepe.

To clarify, are you receiving the 412 regardless every time? Regardless of whether HubSpot throws the NOT_ALLOWED_TO_REPEAT error or the 204 "success"?

If you don't believe the contacts should return the NOT_ALLOWED_TO_REPEAT error, could you link me to the workflow and example contact or two? We discussed this earlier but we went off on a tangent.

Isaac Takushi

Associate Certification Manager
0 Upvotes
Christopher_Pep
Member

Integration 412 error

thats very helpful, thanks. I managed to get the create or update user working by changing to the Hubspot connector (not the right term but I don't know all of your terms yet).

I still get the 412 error while enrolling a contact into a workflow (the Workflows API), however, the error message is sane - it says that the user is already enrolled. Error handling in workato is clunky for me so I'm working thru that. It would be cool if your api would return a success since what I wanted was the user added and they are already there so that's a success to me.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Integration 412 error

Sounds good, @Christopher_Pepe!

To my knowledge, there are no required fields for the Create or update a contact endpoint. Only email is required to create a contact and that's already included in the request URL.

Regarding which values are expected, you can pull all of your account's contact properties via this endpoint and reference the fieldType. You can also see this in the UI.

For example, the Postal code property is a single-line text property, so it'll accept any string.

Isaac Takushi

Associate Certification Manager
0 Upvotes
Christopher_Pep
Member

Integration 412 error

Thanks Isaac. I have been reworking the workato recipe to replace deprecated calls. In that I believe I have narrowed the issue to workato's side. I can successfully call the hubspot apis with postman but fail with workato due to headers or something like that.

One place I could use help is with create or update user in hubspot (https://developers.hubspot.com/docs/methods/contacts/create_or_update). It seems to require a payload but I cannot tell which fields are required and what values are expected. (e.g. is 'zip' required to be numeric? We have EU customers with alphanumeric values).

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Integration 412 error

Apologies for the delayed response, @Christopher_Pepe.

This forum is public, so please never share your API key or an OAuth token! I only need links to the workflow and example contact, which contain your Hub ID and no sensitive data. (No one except a HubSpotter would be able to access your account with the links alone.)

Thanks for including a link to that ticket!

Isaac Takushi

Associate Certification Manager
0 Upvotes
Christopher_Pep
Member

Integration 412 error

Thanks Isaac. I can share all of that. Who is this thread visible to? I'm a little hesitant to share our apikey etc.

https://app.hubspot.com/support/2288549/ticket/2152950

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Integration 412 error

Welcome, @Christopher_Pepe!

Happy to help investigate. Could you share the support ticket number? I'll see what they may have already covered and we'll take it from there.

Also, would you mind sharing links to the workflow in question and a few example contacts you saw this error from?

Isaac Takushi

Associate Certification Manager
0 Upvotes