Companies: create or update by your company_id, update by Intercom id, look up, list, and attach contacts. A company only shows in Intercom's UI once at least one contact is attached.

Context Vars

Optional
  • intercom.token

Functions

attach-contact

fn (company-id: Str, contact-id: Str): Any
fn (company-id: Str, contact-id: Str, opts: Map): Any

Attach a contact to a company (Intercom ids). Same as ::intercom::contacts/attach-company, argument order company-first.

Example

::intercom::companies/attach-contact("66f1a2b3c4d5e6f708192a3b", "6643703ffae7834d1792fd30")

detach-contact

fn (company-id: Str, contact-id: Str): Any
fn (company-id: Str, contact-id: Str, opts: Map): Any

Detach a contact from a company (Intercom ids).

Example

::intercom::companies/detach-contact("66f1a2b3c4d5e6f708192a3b", "6643703ffae7834d1792fd30")

find-company

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

GET /companies?company_id= - The company with your company_id, or an Err with status 404.

Example

company ::intercom::companies/find-company("acme-42")
company.id

get-company

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

GET /companies/{id} - One company by Intercom id.

Example

company ::intercom::companies/get-company("66f1a2b3c4d5e6f708192a3b")
company.name

list-companies

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

GET /companies - Companies by page number: {data, pages, total_count}. options: page, per_page, tag_id, segment_id. Capped at 10,000 companies; beyond that Intercom requires the scroll API (GET /companies/scroll via ::intercom::api/request).

Example

page ::intercom::companies/list-companies({page: 1, per_page: 50})
map(page.data, %.name)

list-contacts

fn (company-id: Str): Any
fn (company-id: Str, options: Map): Any
fn (company-id: Str, options: Map, opts: Map): Any

GET /companies/{id}/contacts - The contacts attached to a company: {data, pages, total_count}. options: page, per_page.

Example

page ::intercom::companies/list-contacts("66f1a2b3c4d5e6f708192a3b", {per_page: 50})
map(page.data, %.email)

update-company

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

PUT /companies/{id} - Update a company by Intercom id. company_id cannot change after creation. Unset fields are omitted.

Example

::intercom::companies/update-company("66f1a2b3c4d5e6f708192a3b", {plan: "enterprise", size: 250})

upsert-company

fn (fields: Map): Any
fn (fields: Map, opts: Map): Any

POST /companies - Create or update a company, matched on your company_id. fields: company_id (or Intercom id), name, plan, size, website, industry, monthly_spend, remote_created_at, custom_attributes (must already exist). Unset fields are omitted.

Example

company ::intercom::companies/upsert-company({company_id: "acme-42", name: "Acme", plan: "enterprise"})
::intercom::companies/attach-contact(company.id, "6643703ffae7834d1792fd30")