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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@inception-emails/ghl-client

v0.1.0

Published

Shared GoHighLevel client for the Inception Emails 3-app system (marketing, checkout, onboarding).

Readme

@inception-emails/ghl-client

Shared GoHighLevel client for the Inception Emails 3-app system (marketing site, checkout, onboarding).

Wraps the GHL v2 REST API with:

  • TypeScript types for the 9 custom fields, 29 tags, and 2 pipelines provisioned in the Inception Emails sub-account (oPTc9Dv3gSsB3uQmYdBd).
  • DNC short-circuit on every write — contacts tagged compliance:dnc are never mutated.
  • Token-bucket rate limiting (default 10 req/s, burst 100) to stay under GHL's ~100 req / 10s per-location ceiling.
  • Exponential-backoff retry on 429 and 5xx; 4xx (other) throws immediately.
  • Stage-name → stage-ID resolution (cached) so callers reference stages by their human name.
  • Schema-drift detection on construction in non-production environments.

Install

npm install @inception-emails/ghl-client

Node ≥20.

Use

import { createGhlClient } from '@inception-emails/ghl-client';

const ghl = createGhlClient({
  pit: process.env.GHL_LOCATION_API_KEY!,   // Private Integration Token, prefix pit-
  locationId: 'oPTc9Dv3gSsB3uQmYdBd',         // Inception Emails sub-account
});

const { contactId, created } = await ghl.upsertContact({
  email: '[email protected]',
  firstName: 'Jane',
  companyName: 'Acme MSP',
  source: 'src:website-form',
});

await ghl.addTags(contactId, ['stage:disco-booked']);
await ghl.setCustomFields(contactId, { vertical: 'MSP', tier: 'Starter' });

await ghl.createOpportunity({
  pipeline: 'sales',
  stage: 'Disco Booked',
  contactId,
  name: 'Acme MSP — Starter pilot',
  monetaryValue: 5000,
});

Public API

All methods throw GhlClientError on failure (loud-not-silent — a dropped contact is a lost lead). DNC contacts make addTags, setCustomFields, and updateContact resolve as no-ops; removeTags is intentionally NOT short-circuited so compliance:dnc itself can be cleared on re-opt-in.

ghl.upsertContact({ email?, phone?, firstName?, lastName?, companyName?, source? })
ghl.findContactByEmail(email)
ghl.findContactByPhone(phone)
ghl.updateContact(contactId, { email?, phone?, firstName?, lastName?, companyName? })
ghl.addTags(contactId, [...tags])
ghl.removeTags(contactId, [...tags])
ghl.setCustomFields(contactId, { vertical?, tier?, monthly_volume_target?, ... })
ghl.createOpportunity({ pipeline, stage, contactId, name, monetaryValue?, status? })
ghl.moveOpportunity(opportunityId, { pipeline, stage, status? })

Tag names

src:{website-form,calendly,checkout,onboarding,referral,cold-outbound}
vertical:{msp,functional-med,property-maint,dental,life-insurance,mortgage}
stage:{lead,disco-booked,disco-completed,pitched,active-client,churned,reactivated,lost}
tier:{starter,accelerator,growth,enterprise}
engagement:{hot,warm,cold,dead}
compliance:dnc

Passing a tag that isn't on this list is a TypeScript compile error.

Custom fields

| Key | GHL dataType | TS type | |---|---|---| | vertical | TEXT | string | | monthly_volume_target | NUMERICAL | number | | tier | TEXT | string | | pilot_started_at | DATE | string (ISO YYYY-MM-DD) | | first_active_campaign_at | DATE | string (ISO YYYY-MM-DD) | | mrr | NUMERICAL | number | | lifetime_revenue | NUMERICAL | number | | disco_call_recording_url | TEXT | string | | onboarding_completed | CHECKBOX | boolean |

companyName is a GHL standard field (not custom). Pass it via upsertContact/updateContact — never via setCustomFields.

Pipelines + stages

| Pipeline key | Stages (in order) | |---|---| | 'sales' | LeadDisco BookedDisco CompletedPitchedWonLost | | 'active-client' | OnboardingFirst CampaignSteady StateAt RiskRenewedChurned |

The TypeScript signature narrows stage to the valid stages for the given pipeline.

Errors

Every failure throws a GhlClientError with { status, endpoint, method, requestId, body }. The pit is never included.

import { GhlClientError } from '@inception-emails/ghl-client';

try {
  await ghl.upsertContact({ email: '[email protected]' });
} catch (err) {
  if (err instanceof GhlClientError) {
    // err.status, err.endpoint, err.requestId, err.body
  }
  throw err;
}

Configuration

createGhlClient({
  pit,                                  // required
  locationId,                           // required
  baseUrl: 'https://services.leadconnectorhq.com',
  apiVersion: '2021-07-28',
  rate: { perSecond: 10, burst: 100 },
  maxRetries: 3,
  baseBackoffMs: 250,
  detectSchemaDrift: process.env.NODE_ENV !== 'production',
});

DEBUG=ghl-client env var emits per-request METHOD path attempt=N lines to stderr (no headers, no PIT).

Source of truth

The schema constants in src/schema.ts mirror INTEGRATION-SOURCE-OF-TRUTH.md §5 in the orchestration repo (~/inception-emails-integration). If the live GHL location drifts from those constants, schema-drift detection logs a warning at construction time.

License

MIT