npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mohammadsaddam-dev/hubspot-toolkit

v0.2.65

Published

Opinionated lightweight HubSpot helper toolkit (contacts, companies, deals, associations, properties)

Readme

@mohammadsaddam-dev/hubspot-toolkit

A lightweight and developer-friendly ES Modules toolkit for interacting with HubSpot CRM APIs.
Supports Contacts, Companies, Deals, Associations, Custom Properties, Search, Pagination, and clean utility helpers.

npm version npm downloads license


🚀 Features

✓ Contacts / Companies / Deals CRUD + Search
✓ Associations (V4 batch + simple helpers)
✓ Custom Properties API
✓ Pagination helper (fetchAllPages)
✓ Upsert helpers (contact by email, company by domain)
✓ Supports API Key (Private App Token) & Access Token
✓ Clean lightweight built-in HubSpot HTTP client
✓ Fully ESM ("type": "module")


📦 Installation

npm install @mohammadsaddam-dev/hubspot-toolkit@latest

🔧 Setup

import { createClient } from "@mohammadsaddam-dev/hubspot-toolkit";

const hubspot = createClient({
  apiKey: process.env.HUBSPOT_API_KEY,   // or ACCESS TOKEN
  accessToken: process.env.HUBSPOT_ACCESS_TOKEN, 
});

If both are provided, accessToken is used.


📘 Usage Examples

➤ Create Contact

import { contacts } from "@mohammadsaddam-dev/hubspot-toolkit";

const response = await contacts.create({
  email: "[email protected]",
  firstname: "John",
  lastname: "Doe",
});

console.log(response);

➤ Update Contact

await contacts.update("12345", {
  firstname: "Updated Name",
});

➤ Get Contact by ID

const data = await contacts.get("12345");
console.log(data);

➤ Fetch All contacts

const all = await hubspot.contacts.getAllContacts();
console.log("Total contacts:", all.length);

➤ Create Deal

import { deals } from "@mohammadsaddam-dev/hubspot-toolkit";

await deals.create({
  dealname: "New Integration Deal",
  amount: 5000,
  dealstage: "appointmentscheduled",
});

➤ Associate Deal ↔ Contact

import { associations } from "@mohammadsaddam-dev/hubspot-toolkit";

await associations.create(
  "deal",
  "contact",
  "deal_id_here",
  "contact_id_here"
);

➤ Fetch All Companies

const companies = await hubspot.companies.getAllCompanies();
console.log(companies);

➤ Fetch Deal Properties

import { properties } from "@mohammadsaddam-dev/hubspot-toolkit";

const dealProps = await properties.get("deals");
console.log(dealProps);

📁 Project Structure

src/
  ├── contacts.js
  ├── companies.js
  ├── deals.js
  ├── associations.js
  ├── properties.js
  ├── utils.js
  └── http/
      └── hubspotClient.js

🧪 Environment Variables

HUBSPOT_API_KEY=your-private-app-token

🛠️ Error Handling

try {
  await contacts.get("invalid-id");
} catch (err) {
  console.error("HubSpot Error:", err.message);
}

📝 License

MIT © Mohammad Saddam