Owners: the HubSpot users (and queues) that records can be assigned to via hubspot_owner_id.

Functions

find-owner-by-email

fn (email: Str): Any
fn (email: Str, opts: Map): Any

The owner with this email, or null. Use its id as a record's hubspot_owner_id.

Example

owner ::hubspot::owners/find-owner-by-email("rep@example.com")
if(is-some(owner), ::hubspot::contacts/update-contact("12345", {hubspot_owner_id: owner.id}), null)

get-owner

fn (owner-id: Str): Map
fn (owner-id: Str, opts: Map): Map
fn (owner-id: Str, id-property: Str): Map
fn (owner-id: Str, id-property: Str, opts: Map): Map

GET /crm/owners/{version}/{ownerId} - One owner by owner id. The 2-arity form looks up by "userId" instead (id-property is "id" or "userId").

Example

owner ::hubspot::owners/get-owner("123")
owner.email

// By user id
::hubspot::owners/get-owner("456", "userId")

list-owners

fn (): Map
fn (params: Map): Map
fn (params: Map, opts: Map): Map

GET /crm/owners/{version} - One page of owners: {results: [{id, email, firstName, lastName, userId, type, teams, archived}], paging?}. params: email (exact match), limit (max 500), after, archived.

Example

page ::hubspot::owners/list-owners({limit: 100})
map(page.results, %.email)