Skip to content

Instantly share code, notes, and snippets.

@isaidspaghetti
Created July 17, 2020 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaidspaghetti/d074eaad8678d4c86c928983948ba38e to your computer and use it in GitHub Desktop.
Save isaidspaghetti/d074eaad8678d4c86c928983948ba38e to your computer and use it in GitHub Desktop.
create hubspot contact
//backend/routes/index.js:10
async function createHubspotContact(firstName, lastName) {
const hubspot = new Hubspot({
apiKey: process.env.HUBSPOT_API_KEY,
checkLimit: false
})
const contactObj = {
properties: [
{ property: 'firstname', value: firstName },
{ property: 'lastname', value: lastName },
{ property: 'email', value: email },
{
property: 'your_custom_property',
value: 'anything you want, even a multi-line \n string'
}
]
}
const hubspotContact = hubspot.contacts.create(contactObj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment