Functions

archive-company

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

Archive a company (recycle bin, restorable for 90 days).

Example

::hubspot::companies/archive-company("12345")

create-company

fn (properties: Map): Map
fn (properties: Map, opts: Map): Map

Create a company from a properties Map (name, domain, industry, ...).

Example

company ::hubspot::companies/create-company({name: "Acme", domain: "acme.com"})
company.id

// Another portal's token for this call
::hubspot::companies/create-company({name: "Acme"}, {token: ::hot::ctx/get("tenant.hubspot.token")})

find-by-domain

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

Search for a company by exact domain. Returns the company or null.

Example

company ::hubspot::companies/find-by-domain("acme.com")
if(is-some(company), company.id, null)

get-company

fn (id: Str): Map
fn (id: Str, opts: Map): Map
fn (id: Str, properties: Vec): Map
fn (id: Str, properties: Vec, opts: Map): Map

Fetch a company by id; the 2-arity form selects properties.

Example

company ::hubspot::companies/get-company("12345", ["name", "domain"])
company.properties.name

search-companies

fn (options: Map): Map
fn (options: Map, opts: Map): Map

Search companies — see ::hubspot::objects/build-search-body for the options.

Example

out ::hubspot::companies/search-companies({
  filters: [{propertyName: "industry", operator: "EQ", value: "COMPUTER_SOFTWARE"}],
  properties: ["name", "domain"],
  limit: 50
})
map(out.results, %.id)

update-company

fn (id: Str, properties: Map): Map
fn (id: Str, properties: Map, opts: Map): Map

Update a company's properties.

Example

::hubspot::companies/update-company("12345", {industry: "COMPUTER_SOFTWARE"})