Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/hubspot

src/index.ts

64 lines · 1.6 KB · TypeScript
import {
	privateAppSetupUrl,
	oauthConnectUrl,
	DEFAULT_OAUTH_SCOPES,
	HUBSPOT_CALLBACK_URL,
	HUBSPOT_REQUIRED_HOSTS,
	HUBSPOT_SCOPES,
} from './setup.ts'

/**
 * Describe the HubSpot package, auth lanes, and export surface.
 * @example
 * import hubspot from 'kody:@kody/hubspot'
 * const overview = await hubspot()
 */
export default async function hubspotOverview() {
	return {
		name: 'HubSpot',
		auth: {
			oauth: {
				defaultIntegration: 'hubspot',
				connectUrl: oauthConnectUrl('hubspot'),
				callbackUrl: HUBSPOT_CALLBACK_URL,
				scopes: HUBSPOT_SCOPES,
				defaultScopes: [...DEFAULT_OAUTH_SCOPES],
				scopeSeparator: ' ',
				requiredHosts: [...HUBSPOT_REQUIRED_HOSTS],
			},
			privateApp: {
				defaultSecret: 'hubspotPrivateAppToken',
				setupUrl: privateAppSetupUrl('hubspotPrivateAppToken'),
				requiredHosts: [...HUBSPOT_REQUIRED_HOSTS],
			},
		},
		safety: 'Mutating operations require confirm: true and support dryRun: true.',
		exports: {
			setup: ['accounts', 'smoke-test', 'account'],
			generic: ['objects', 'list-objects', 'get-object', 'search-objects'],
			contacts: [
				'list-contacts',
				'get-contact',
				'search-contacts',
				'create-contact',
				'update-contact',
			],
			companies: [
				'list-companies',
				'get-company',
				'search-companies',
				'create-company',
				'update-company',
			],
			deals: ['list-deals', 'get-deal', 'search-deals', 'create-deal', 'update-deal'],
			tickets: [
				'list-tickets',
				'get-ticket',
				'search-tickets',
				'create-ticket',
				'update-ticket',
			],
			advanced: ['request'],
		},
	}
}