sales-reporting

Daily briefings, pipeline snapshots, and win/loss analysis from the terminal — closing-this-week, open pipeline by stage/owner, and closed-won vs closed-lost over a period.

By hubspot · 1,314 installs

npx skills add hubspot/agent-cli-skills --skill sales-reporting

Source repository · Upstream listing

Source of truth hubspot <command help is authoritative. Build on bulk operations/SKILL.md — JSONL shape, batch read rules, and pagination live there. Reshape patterns: bulk operations/resources/json patterns.md . search / list cap at 100 rows per call; a result of exactly 100 is almost always truncated — paginate via bulk operations/SKILL.md before aggregating. Property and output shape notes All CRM property values come back as strings in JSONL — booleans included. hs is closed won is returned as "true" / "false" (string); amount is a numeric string. Use tonumber for arithmetic; compare booleans as strings ( == "true" ) when filtering client side. Numeric properties can be null or an empty string ( "" ) when unset/blank. tonumber aborts on "" . Always guard with select(. != null and . != "") tonumber . In filter expressions, hs is closed won=true and hs is closed!=true work — the API parses the value. properties returns the standard nested shape: {"id":"123","properties":{"amount":"5000","dealname":"..."}} . Reference fields as .properties.amount in jq. Stage IDs in dealstage are portal specific. Map them with hubspot pipelines stages type deals pipeline <id (or read the stages array embedded in hubspot pipelines list/get ). hubspot pipelines is app token only — see Auth section; it 403s under user OAuth. hubspot owner id is a numeric string. Resolve to a name with hubspot owners list (fields: id , firstName , lastName , email ). hubspot owners list works under both user OAuth ( hubspot auth login ) and a service key. 1. Daily briefing Date windows differ between macOS and GNU date : Deals closing in the next 7 days: Deals updated in the last 24h: Open pipeline summary line: 2. Pipeline snapshot By stage — count and amount per dealstage : By owner: To label owner IDs with names, dump the owners file once and join: 3. Win/loss analysis Filter on hs is closed won=true for won; hs is closed=true AND hs is closed won!=true for lost. Scope with closedate =YYYY MM DD AND closedate<YYYY MM DD . Closed won / lost in a period: Win rate by rep — pull all closed deals in the period, group, divide. Note: hs is closed won lands as a string, so compare == "true" . Revenue by close month (won deals): 4. Saved reports The hubspot reports family runs HubSpot's saved reports and CRM SQL reports server side, so you don't have to recompute aggregates client side: reports list / get <id — browse and inspect saved reports. reports fetch dataset <id — re execute a saved report server side and return its dataset. reports create "<CRM SQL " — create a report from a CRM SQL query (a companion skill can generate the SQL); reports insights <id generates AI insights (async, polls to completion). reports update <id / clone <id / favorite <id / unfavorite <id — manage report metadata. reports delete <id — irreversible, digest gated: dry run first, then digest <hash confirm "<report name " (confirm = the report's name). Run hubspot reports help for the full surface and the CRM SQL grammar. 5. Win/loss context: sequence enrollments hubspot sequences enrollments <contact id returns a contact's Sales Hub sequence enrollment history (read only) — useful for attributing wins/losses to outreach. Each row: {"contactId":789,"enrollments":[{"sequenceName":"Q4 Outbound","state":"FINISHED","enrolledAt":"...","currentStepOrder":5,"totalSteps":6}]} . Join it to a deal's associated contacts for a "was this deal worked through a sequence?" view. See hubspot sequences enrollments help . Known limitations Won/lost stages are identifiable from hubspot pipelines stages : each stage's metadata carries isClosed / probability (e.g. jq r 'select(.metadata.probability=="1.0") .id' ). hs is closed won on the deal itself also works. No team object — group by hubspot owner id and resolve names from hubspot owners list client side. hubspot pipelines is app token only and 403s under user OAuth. hubspot owners list works under user OAuth. Keep raw IDs + warn; do not fail the report when pipelines is unavailable. Numeric CRM properties can be null or "" ; always guard tonumber with select(. != null and . != "") .