@kody/hubspot
Read HubSpot contacts, companies, deals, and tickets, with dry-run writes and generic CRM object reads.
README.md
117 lines · 5.9 KB · Markdown@kody/hubspot
Intent
Provide reusable, account-agnostic HubSpot CRM helpers so Kody agents can read
contacts, companies, deals, tickets, and other CRM objects through a saved
hubspot / hubspot-* OAuth integration or a private-app token — without
hand-rolling REST. Mutations are previewable with dryRun: true and only run
live after confirm: true.
This listing is meant to be forked. After you fork, connect your HubSpot
portal. Do not treat the live @kody/hubspot package storage as yours.
What it does
- List, get, or search contacts, companies, deals, and tickets
- Read any other CRM object type through the generic object helpers
- Preview or apply contact / company / deal / ticket writes after confirmation
- Call an unwrapped HubSpot REST path through
./request - Connect more than one HubSpot portal via
integrationName/account
Prerequisites / setup
HubSpot has no built-in Kody OAuth app. Choose one lane:
| Lane | When to use | Credential |
|---|---|---|
| OAuth (recommended) | Multi-account, refresh tokens, shared helpers | Saved integration hubspot or hubspot-<purpose> |
| Private app token | Fastest for a single portal | User secret hubspotPrivateAppToken (or hubspotPrivateAppToken-<purpose>) |
Both lanes send Authorization: Bearer …. Required API hosts:
api.hubapi.com and api.hubspot.com. Approve them in the account
secrets UI.
Lane A — BYO OAuth
- Create an OAuth app from https://developers.hubspot.com/docs/apps/developer-platform/build-apps/create-an-app
- Set the redirect URI exactly to
https://kody.codes/connect/oauth - Enable the required CRM scopes listed below (
oauthis required on every HubSpot OAuth app). Addcrm.objects.custom.readas an optional scope if you need custom objects on Enterprise portals. - Connect while signed in to Kody:
- Paste the HubSpot client id and client secret into the Kody wizard (never
into chat). Approve hosts
api.hubapi.comandapi.hubspot.com. - Reconnect later with https://kody.codes/connect/oauth?provider=hubspot
OAuth authorize URL: https://app.hubspot.com/oauth/authorize. Token URL:
https://api.hubapi.com/oauth/v3/token. Flow: confidential (client secret).
HubSpot scopes are space-separated.
To connect a second portal, change provider (for example
provider=hubspot-work) and pass integrationName: 'hubspot-work' on every
call.
Lane B — Private app token
- Create a private app from https://developers.hubspot.com/docs/apps/legacy-apps/private-apps/overview (Development → Legacy apps) and grant the same CRM scopes.
- Save the access token (do not paste the value in chat):
For a second portal/token, use a distinct secret name such as
hubspotPrivateAppToken-work and pass secretName: 'hubspotPrivateAppToken-work'
(or account: 'work', which resolves to hubspot-work /
hubspotPrivateAppToken-work).
Scopes
| Scope | Needed for |
|---|---|
oauth | Required on every HubSpot OAuth app; ./account, ./smoke-test |
crm.objects.contacts.read | ./list-contacts, ./get-contact, ./search-contacts |
crm.objects.contacts.write | ./create-contact, ./update-contact |
crm.objects.companies.read | ./list-companies, ./get-company, ./search-companies |
crm.objects.companies.write | ./create-company, ./update-company |
crm.objects.deals.read | ./list-deals, ./get-deal, ./search-deals |
crm.objects.deals.write | ./create-deal, ./update-deal |
tickets | Ticket reads and writes |
crm.objects.custom.read | Generic custom-object reads (Enterprise, optional) |
If HubSpot returns 401/403 or a missing-scope error, helpers throw a message that names the missing scope and the next setup URL (reconnect OAuth with that scope, or save a private-app token).
Agents: see AGENTS.md for import paths, smoke checks, and
mutation guards.
Done when
- OAuth
hubspotis connected orhubspotPrivateAppTokenis saved; hostsapi.hubapi.comandapi.hubspot.comare approved - Smoke test returns
ok: true(live portal id when credentials exist; no email) - Mutating helpers refuse unless
confirm: true;dryRun: truenever calls HubSpot
Branding
The community icon is HubSpot's official orange sprocket (#FF7A59) from the
HubSpot brand mark as published in Simple Icons.
Paths are unmodified. HubSpot® is a trademark of HubSpot, Inc.
This package is not affiliated with or endorsed by HubSpot, Inc.
Share this listing at https://kody.codes/@kody/hubspot