Lists (segments) of contacts, companies, deals, and other records.
MANUAL and SNAPSHOT lists take explicit membership changes;
DYNAMIC lists are driven by a filterBranch. List APIs address
object types by type id: object-type-id("contacts") gives "0-1".
Values
OBJECT_TYPE_IDS
OBJECT_TYPE_IDS: Map {
contacts: "0-1",
companies: "0-2",
deals: "0-3",
tickets: "0-5"
}
Functions
add-members
fn (list-id: Str, record-ids: Vec): Map
fn (list-id: Str, record-ids: Vec, opts: Map): Map
PUT /crm/lists/{version}/{listId}/memberships/add - Add records (Vec of record ids) to a MANUAL or SNAPSHOT list. Returns {recordsIdsAdded, recordIdsMissing}.
build-list-body
fn (name: Str, object-type: Str, processing-type: Str, options: Map): Map
The create-list payload. options: filterBranch (required for DYNAMIC lists), listFolderId. Exposed for testing.
create-list
fn (name: Str, object-type: Str, processing-type: Str): Map
fn (name: Str, object-type: Str, processing-type: Str, options: Map): Map
fn (name: Str, object-type: Str, processing-type: Str, options: Map, opts: Map): Map
POST /crm/lists/{version} - Create a list. processing-type is
"MANUAL" (you add and remove members), "SNAPSHOT" (filters
evaluated once, then manual), or "DYNAMIC" (pass a filterBranch in
options). Returns {list: {listId, name, ...}}.
Example
::lists ::hubspot::lists
created ::lists/create-list("Webinar attendees", "contacts", "MANUAL")
::lists/add-members(created.list.listId, ["12345", "67890"])
delete-list
fn (list-id: Str): Any
fn (list-id: Str, opts: Map): Any
DELETE /crm/lists/{version}/{listId} - Delete a list (restorable for 90 days with HubSpot's restore endpoint). Members are not deleted.
find-list-by-name
fn (object-type: Str, name: Str): Map
fn (object-type: Str, name: Str, opts: Map): Map
GET /crm/lists/{version}/object-type-id/{objectTypeId}/name/{listName} - Look up a list by exact name. Returns {list}, or an Err (404) when no list has that name.
get-list
fn (list-id: Str): Map
fn (list-id: Str, opts: Map): Map
GET /crm/lists/{version}/{listId} - One list: {list: {listId, name, processingType, objectTypeId, size?, ...}}.
list-members
fn (list-id: Str): Map
fn (list-id: Str, params: Map): Map
fn (list-id: Str, params: Map, opts: Map): Map
GET /crm/lists/{version}/{listId}/memberships - One page of members: {results: [{recordId, membershipTimestamp}], paging?}. params: limit (max 250), after, before.
object-type-id
fn (object-type: Str): Str
The object type id for a standard object name (contacts 0-1, companies 0-2, deals 0-3, tickets 0-5). Anything else (e.g. an id like "2-123456" for a custom object) passes through.
remove-members
fn (list-id: Str, record-ids: Vec): Map
fn (list-id: Str, record-ids: Vec, opts: Map): Map
PUT /crm/lists/{version}/{listId}/memberships/remove - Remove records (Vec of record ids) from a MANUAL or SNAPSHOT list. Returns {recordIdsRemoved, recordIdsMissing}.
search-lists
fn (query: Str): Map
fn (query: Str, options: Map): Map
fn (query: Str, options: Map, opts: Map): Map
POST /crm/lists/{version}/search - Search lists by name. options: processingTypes (Vec), count (page size), offset, objectTypeId (or an object name). Returns {lists, hasMore, offset, total}.