{"library":"node-hubspot-api","title":"HubSpot API Client for Node.js","description":"The `node-hubspot-api` package provides a Node.js wrapper for interacting with the HubSpot API. Currently at version 1.3.1, this library simplifies common API operations such as retrieving, creating, and updating contacts, and fetching deals. It employs a promises-based architecture for asynchronous operations, returning data in `.then()` and catching errors in `.catch()`. The release cadence is moderate, with several minor releases since v1.0.0, indicating ongoing maintenance and incremental feature additions, such as new methods for getting contacts by email or ID, and bug fixes. Its primary differentiator is its straightforward, idiomatic JavaScript interface to the HubSpot CRM platform, abstracting the underlying HTTP complexities. This wrapper directly exposes common HubSpot API endpoints through a convenient object structure, focusing on essential CRM entities.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install node-hubspot-api"],"cli":null},"imports":["import NodeHubSpotApi from 'node-hubspot-api'","import type { NodeHubSpotApi } from 'node-hubspot-api'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import NodeHubSpotApi from 'node-hubspot-api';\n\n// It is crucial to manage API keys securely, e.g., via environment variables.\nconst HUBSPOT_API_KEY = process.env.HUBSPOT_API_KEY ?? 'YOUR_SECRET_API_KEY'; \n\nconst api = new NodeHubSpotApi(HUBSPOT_API_KEY);\n\n// Example: Get all contacts with specific properties\napi.contacts.getAll({\n  count: 2, // Fetch a small number for a quick example\n  property: [\n    'firstname', 'lastname', 'email', 'company'\n  ],\n  showListMemberships: false\n})\n.then(response => {\n  console.log('Successfully fetched contacts:');\n  if (response.data && response.data.contacts) {\n    response.data.contacts.forEach(contact => {\n      console.log(`- ${contact.properties.firstname?.value} ${contact.properties.lastname?.value} (${contact.properties.email?.value})`);\n    });\n  } else {\n    console.log('No contacts found or unexpected response structure.');\n  }\n})\n.catch(error => {\n  console.error('Error fetching contacts:', error.response ? error.response.data : error.message);\n});\n\n// Example: Get a contact by email\nconst targetEmail = 'test@example.com'; // Replace with a real email for testing\napi.contacts.getContactByEmail(targetEmail, {\n  property: ['firstname', 'lastname', 'email'],\n})\n.then(response => {\n  console.log(`\\nSuccessfully fetched contact by email \"${targetEmail}\":`);\n  console.log(response.data);\n})\n.catch(error => {\n  if (error.response && error.response.status === 404) {\n    console.warn(`\\nContact with email \"${targetEmail}\" not found.`);\n  } else {\n    console.error(`\\nError fetching contact by email \"${targetEmail}\":`, error.response ? error.response.data : error.message);\n  }\n});","lang":"javascript","description":"This quickstart demonstrates how to initialize the HubSpot API client with an API key and perform basic operations like fetching a list of contacts and a single contact by email.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}