Get the API key in Settings -> Integrations -> API Key section of the Hubspot dashboard.
Install the Hubspot API client package:
npm install @hubspot/api-client --save
or using yarn:
yarn add @hubspot/api-client
Import the Hubspot API client library:
const hubspot = require('@hubspot/api-client');
Instantiate Hubspot API client:
const hubspotClient = new hubspot.Client({
apiKey: process.env.HUBSPOT_API_KEY,
});
Create Hubspot contact:
const properties = {
email: 'user@example.com',
firstname: 'Jack',
lastname: 'Jones',
}
const { response, body } =
await hubspotClient.crm.contacts.basicApi.create({
properties,
});
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.