Skip to content

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

Package listing

@kody/hubspot

src/update-contact.ts

27 lines · 914 B · TypeScript
import { updateStandard, parseUpdateInput, type StandardUpdateInput } from './wrappers.ts'

/**
 * Update a HubSpot contact. Requires `confirm: true`, or use `dryRun: true`.
 * @example
 * import updateContact from 'kody:@kody/hubspot/update-contact'
 * const preview = await updateContact({
 *   id: '123',
 *   properties: { },
 *   dryRun: true,
 * })
 */
export async function updateContact(input: StandardUpdateInput) {
	return updateStandard('contacts', input)
}

/**
 * Update a HubSpot contact. Requires `confirm: true`, or use `dryRun: true`.
 * @example
 * import updateContact from 'kody:@kody/hubspot/update-contact'
 * const preview = await updateContact({ id: '123', properties: {}, dryRun: true })
 */
export default async function updateContactEntrypoint(
	params: Partial<StandardUpdateInput> & Record<string, unknown> = {},
) {
	return updateContact(parseUpdateInput(params, 'update-contact'))
}