const body = {
"properties": {
"email": data.email,
"phone": "(877) 929-0687",
"company": "Biglytics",
"website": "biglytics.net",
"lastname": data.lastname,
"firstname": data.firstname
}
};
// Make the POST request to HubSpot
const response = await fetch('https://api.hubapi.com/crm/v3/objects/contacts', {
method: 'POST',
headers: {
'content-type': 'application/json',
'authorization': `Bearer ${HUBSPOT_ACCESS_TOKEN}`
},
body: JSON.stringify(body)
});
if (response.ok) {
const result = await response.json();
console.log(result);
} else {
throw new Error(`HubSpot API responded with status: ${response.status}`);
}
const body = {
"properties": {
"email": data.email,
"phone": "(877) 929-0687",
"company": "Biglytics",
"website": "biglytics.net",
"lastname": data.lastname,
"firstname": data.firstname
}
};
// Make the POST request to HubSpot
const response = await fetch('https://api.hubapi.com/crm/v3/objects/contacts', {
method: 'POST',
headers: {
'content-type': 'application/json',
'authorization': `Bearer ${HUBSPOT_ACCESS_TOKEN}`
},
body: JSON.stringify(body)
});
if (response.ok) {
const result = await response.json();
console.log(result);
} else {
throw new Error(`HubSpot API responded with status: ${response.status}`);
}