Functions
archive-deal
fn (id: Str): Any
fn (id: Str, opts: Map): Any
Archive a deal (recycle bin, restorable for 90 days).
Example
::hubspot::deals/archive-deal("12345")
create-deal
fn (properties: Map): Map
fn (properties: Map, opts: Map): Map
Create a deal from a properties Map (dealname, amount,
dealstage, pipeline, closedate, hubspot_owner_id, ...).
dealstage and pipeline are ids, not labels: resolve them with
::hubspot::pipelines/find-stage.
Example
stage ::hubspot::pipelines/find-stage("deals", "default", "Qualified To Buy")
deal ::hubspot::deals/create-deal({
dealname: "Acme expansion",
amount: "24000",
pipeline: stage.pipeline_id,
dealstage: stage.stage_id
})
::hubspot::objects/associate("deals", deal.id, "companies", "9876")
get-deal
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 deal by id; the 2-arity form selects properties.
Example
deal ::hubspot::deals/get-deal("12345", ["dealname", "amount"])
deal.properties.dealname
search-deals
fn (options: Map): Map
fn (options: Map, opts: Map): Map
Search deals — see ::hubspot::objects/build-search-body for the
options.
Example
out ::hubspot::deals/search-deals({
filters: [{propertyName: "dealstage", operator: "EQ", value: "closedwon"}],
properties: ["dealname", "amount"],
limit: 50
})
map(out.results, %.id)
update-deal
fn (id: Str, properties: Map): Map
fn (id: Str, properties: Map, opts: Map): Map
Update a deal's properties (e.g. {dealstage: "closedwon"}).
Example
::hubspot::deals/update-deal("12345", {dealstage: "closedwon"})