As the title says, contact isn’t created when form is submitted with Hubspot user token set.
I submitted form data to my HubSpot form using this endpoint.
I confirmed I got HubSpot user token which is stored in browser as “hubspotutk” and submitted form with it.
When I submitted form without the token, contact was successfully created.
My code is as follows:
const options = {
method: 'post',
headers: {
'Content-Type': 'application/json',
},
withCredentials: true,
};
const portalId = 'xxxxx';
const formGuid = 'xxxxx';
const url = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formGuid}`;
await axios.post(
url,
{
portalId,
formGuid,
fields: [
{
objectTypeId: '0-1',
name: 'lastname',
value: 'test1',
},
{
objectTypeId: '0-1',
name: 'firstname',
value: 'test2',
},
{
objectTypeId: '0-1',
name: 'email',
value: 'test@example.com',
},
{
objectTypeId: '0-1',
name: 'phone',
value: 0801234567,
},
{
objectTypeId: '0-2',
name: 'name',
value: 'test,Inc',
},
],
context: {
hutk: 'xxxxxxxx',
pageUri: 'http://localhost:5500/test',
pageName: 'test page',
},
},
options,
);
Hope someone tells me to work it out.