Form Submission returns 200 but no submissions showing
Hello,
I'm currently trying to integrate a form.
I have created the custom form and set up the below code, sending the raw JSON via postman returns 200 with an empty object and nothing more, no submissions are showing in hubspot.
Below is the code (TypeScript) with some details replaced with placeholders (keys etc). Any help would be appreciated.
const res = await fetch(
`https://api.hsforms.com/submissions/v3/integration/secure/submit/${portalId}/${formGuid}`,
{
method: "POST",
headers: {
authorization: `${HUBSPOT_API_PAT}`,
"Content-Type": "application/json",
},
body: {
timestamp: currentDate.getTime(),
fields: [
{
objectTypeId: "0-1",
name: "firstname",
value: "John",
},
{
objectTypeId: "0-1",
name: "lastname",
value: "Doe",
},
{
objectTypeId: "0-1",
name: "email",
value: "example@test.com",
},
{
objectTypeId: "0-1",
name: "zip",
value: "QW11ER,
},
{
objectTypeId: "0-1",
name: "taster_session",
value: "session picked",
},
],
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.",
},
],
},
},
},
}
Form Submission returns 200 but no submissions showing
Hi, @RSaunders7👋 Welcome to our community! I hope you got this resolved.
If not, have you tried stringifying the JSON payload in the body of your fetch request? Also, you may need to adjust your timestamp field to be submittedAt: currentDate.getTime()
Have fun testing! — Jaycee
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !