we are integrating hubspot and the first step is sending all form post via AJAX API, client based, to Hubspot. On every field the form editor shows me the name, but not for the opt-in checkbox. So I looked into the HTML and found the field name "LEGAL_CONSENT.subscription_type_6864921"
When I send the request, I get this response:
{
"status": "error",
"message": "Invalid input JSON on line 1, column 309: Cannot build FormSubmissionValue, some of required attributes are not set [value]",
"correlationId":"c618dd3e-36e1-4a6e-89da-91d0bf02d10f",
"requestId":"767b7784-1752-45ac-8f16-a7dec04aabb9"
}
Is something missing? Is there a documentation somewhere?
We document the v3 form submission endpoint here; that error isn't explicitly documented though. My guess is there some formatting issue with your submission body. Can you send me an example of the raw submission body you're sending to HubSpot? You can sanitize sensitive values, or send it to me in a private message.
Here's an example of what a valid JSON body would look like:
{
"submittedAt": "1517927174000", // This millisecond timestamp is optional. Update the value from "1517927174000" to avoid an INVALID_TIMESTAMP error.
"fields": [
{
"name": "email",
"value": "example@example.com"
},
{
"name": "firstname",
"value": "Jeff"
}
],
"context": {
"hutk": ":hutk", // include this parameter and set it to the hubspotutk cookie value to enable cookie tracking on your submission
"pageUri": "www.example.com/page",
"pageName": "Example page"
},
"legalConsentOptions": {
"consent": { // Include this object when GDPR options are enabled
"consentToProcess": true,
"text": "I agree to allow Example Company to store and process my personal data.",
"communications": [
{
"value": true,
"subscriptionTypeId": 999,
"text": "I agree to receive marketing communications from Example Company."
}
]
}
}
}
We document the v3 form submission endpoint here; that error isn't explicitly documented though. My guess is there some formatting issue with your submission body. Can you send me an example of the raw submission body you're sending to HubSpot? You can sanitize sensitive values, or send it to me in a private message.
Here's an example of what a valid JSON body would look like:
{
"submittedAt": "1517927174000", // This millisecond timestamp is optional. Update the value from "1517927174000" to avoid an INVALID_TIMESTAMP error.
"fields": [
{
"name": "email",
"value": "example@example.com"
},
{
"name": "firstname",
"value": "Jeff"
}
],
"context": {
"hutk": ":hutk", // include this parameter and set it to the hubspotutk cookie value to enable cookie tracking on your submission
"pageUri": "www.example.com/page",
"pageName": "Example page"
},
"legalConsentOptions": {
"consent": { // Include this object when GDPR options are enabled
"consentToProcess": true,
"text": "I agree to allow Example Company to store and process my personal data.",
"communications": [
{
"value": true,
"subscriptionTypeId": 999,
"text": "I agree to receive marketing communications from Example Company."
}
]
}
}
}