
conversation-history-brief
Pull full conversation history for a CRM contact — fetch associated threads across all inboxes, retrieve message content, and assemble structured data for account briefs showing channel types, thread statuses, last activity, and key message excerpts.
- Installs
- 186
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/hubspot/agent-cli-skills --skill conversation-history-brief- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads conversation-history-brief automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Requires the conversations command group from hub-cli PR #251. hubspot conversations --help is authoritative. Also read communication-history/SKILL.md for CRM activity history (calls, emails, notes) — this skill covers the Conversations inbox surface only.
How threads associate to contacts
conversations threads list accepts --associated-contact-id. You must also supply --inbox-id — there is no portal-wide contact thread lookup without knowing the inbox. To cover all inboxes, enumerate them first (step 1), then query per inbox.
Paging: never collect a full result set with --format jsonl
Every conversations list command defaults to --limit 100 and returns a cursor for the next page. --format jsonl prints only the data rows — the cursor is surfaced only by --format json, at .meta.next. Piping --format jsonl into a file therefore silently truncates at the first 100 rows, and raising --limit is not a fix because the endpoint caps the page size.
Use this helper for anything that must see every row:
# conv_page <output-file> <conversations list args...>
# Pages a conversations list endpoint to exhaustion, writing one JSON object
# per line to <output-file>.
conv_page() {
out=$1; shift
after=""
: > "$out"
while :; do
if [ -n "$after" ]; then
page=$(hubspot "$@" --format json --after "$after") || return 1
else
page=$(hubspot "$@" --format json) || return 1
fi
printf '%s' "$page" | jq -c '.data[]' >> "$out"
after=$(printf '%s' "$page" | jq -r '.meta.next // empty')
[ -n "$after" ] || break
done
}
A bare --format jsonl is still fine for eyeballing the first page interactively.
1. Enumerate inboxes
conv_page /tmp/inboxes.jsonl conversations inboxes list
# {"id":"123","name":"Support Inbox","createdAt":"...","updatedAt":"..."}
# {"id":"124","name":"Sales Chat","createdAt":"...","updatedAt":"..."}
2. Find all threads for a contact
Loop over inbox IDs and collect threads associated with the contact:
CONTACT_ID=73235
: > /tmp/contact_threads.jsonl # truncate output file
while IFS= read -r inbox; do
inbox_id=$(echo "$inbox" | jq -r '.id')
conv_page /tmp/inbox_threads.jsonl conversations threads list \
--inbox-id "$inbox_id" \
--associated-contact-id "$CONTACT_ID"
cat /tmp/inbox_threads.jsonl >> /tmp/contact_threads.jsonl
done < /tmp/inboxes.jsonl
echo "Total threads found: $(wc -l < /tmp/contact_threads.jsonl)"
Thread output shape:
{"id":"111","status":"OPEN","createdAt":"2026-07-28T10:02:00Z","latestMessageTimestamp":"2026-07-30T14:22:00Z","assignedTo":"A-78901","inboxId":"123","originalChannelId":"1000","originalChannelAccountId":"148662","associatedContactId":"73235","spam":false,"archived":false}
Two fields that are easy to assume and are not on a thread:
- No
channelType. A thread names its originating channel by id only, inoriginalChannelId. Resolve it to a human-readable type by joining againstconversations channels list, which returns{"id":"1000","name":"Support Email","type":"EMAIL","inboxId":"123"}(step 3 below). - No guaranteed
subject.status(OPEN/CLOSED), timestamps,assignedToand the channel ids are the dependable fields. Always read a subject through a// "(no subject)"fallback.
3. Resolve channel ids to channel types
: > /tmp/channels.jsonl
while IFS= read -r inbox; do
inbox_id=$(echo "$inbox" | jq -r '.id')
conv_page /tmp/inbox_channels.jsonl conversations channels list --inbox-id "$inbox_id"
cat /tmp/inbox_channels.jsonl >> /tmp/channels.jsonl
done < /tmp/inboxes.jsonl
# {"1000":"EMAIL","1001":"LIVE_CHAT"}
jq -s 'map({key: (.id|tostring), value: .type}) | from_entries' \
/tmp/channels.jsonl > /tmp/channel_types.json
Helper used by the steps below to label a thread:
CHANNEL_TYPES=$(cat /tmp/channel_types.json)
4. Fetch messages for each thread
messages list pages like every other list endpoint, so page it rather than taking the first 100:
: > /tmp/all_messages.jsonl
while IFS= read -r thread; do
tid=$(echo "$thread" | jq -r '.id')
conv_page /tmp/thread_messages.jsonl conversations messages list --thread-id "$tid"
jq -c --argjson thread "$thread" --argjson types "$CHANNEL_TYPES" \
'. + {
_threadId: $thread.id,
_subject: ($thread.subject // "(no subject)"),
_channelType: ($types[($thread.originalChannelId | tostring)] // "UNKNOWN")
}' /tmp/thread_messages.jsonl \
>> /tmp/all_messages.jsonl
done < /tmp/contact_threads.jsonl
Message output shape:
{"id":"222","type":"MESSAGE","text":"Hello, I have a billing question.","sender":{"actorId":"A-456","name":"Jane Doe"},"createdAt":"2026-07-30T14:20:00Z"}
To get a single message in full detail:
hubspot conversations messages get --thread-id 111 --message-id 222 --format jsonl
5. Compact timeline for an account brief
Produce a human-readable thread summary ordered by most recent activity. Note the -s: the file is JSONL, so without slurping, sort_by is handed one object at a time and jq exits 5 with Cannot index string with string instead of printing a timeline.
echo "=== Conversation History for Contact $CONTACT_ID ==="
jq -sr --argjson types "$CHANNEL_TYPES" \
'sort_by(.latestMessageTimestamp) | reverse[] |
"\(.latestMessageTimestamp[0:10]) \($types[(.originalChannelId | tostring)] // "?") [\(.status)] \(.subject // "(no subject)")"' \
/tmp/contact_threads.jsonl
Key message excerpts (first message per thread):
echo ""
echo "=== First message per thread ==="
while IFS= read -r thread; do
tid=$(echo "$thread" | jq -r '.id')
subject=$(echo "$thread" | jq -r '.subject // "(no subject)"')
first_msg=$(hubspot conversations messages list --thread-id "$tid" --limit 1 --format jsonl \
| jq -r '.text // .richText // "(no text)" | .[0:200]')
echo "[$tid] $subject: $first_msg"
done < /tmp/contact_threads.jsonl
6. Structured account brief section
Emit a JSON block suitable for embedding in a larger account brief:
jq -n \
--argjson threads "$(jq -s '.' /tmp/contact_threads.jsonl)" \
--argjson types "$CHANNEL_TYPES" \
--arg contact_id "$CONTACT_ID" \
'{
conversations: {
contact_id: $contact_id,
total_threads: ($threads | length),
open_threads: ($threads | map(select(.status=="OPEN")) | length),
channels: ($threads | map($types[(.originalChannelId | tostring)] // "UNKNOWN") | unique),
latest_activity: ($threads | sort_by(.latestMessageTimestamp) | last | .latestMessageTimestamp),
threads: ($threads | map({
id: .id,
subject: (.subject // "(no subject)"),
status: .status,
channel: ($types[(.originalChannelId | tostring)] // "UNKNOWN"),
last_activity: .latestMessageTimestamp,
assigned_to: (.assignedTo // null)
}))
}
}'
Combining with CRM activity history
For a full pre-call brief, combine this skill with communication-history/SKILL.md:
CONTACT_ID=73235
echo "=== CRM Activity (calls, emails, notes) ==="
hubspot activities list --contact $CONTACT_ID --limit 10 \
| jq -r '"\(.timestamp[0:10]) \(.type) \(.title)"'
echo ""
echo "=== Conversations Inbox Threads ==="
# ... run the thread loop from step 2 above ...
Known constraints
threads listrequires--inbox-id— must loop over all inboxes to get a full picture.- No server-side filter on date range — filter with
jqclient-side usinglatestMessageTimestamp. - Every
listcommand pages at 100 rows and only--format jsonexposes the cursor (.meta.next). Useconv_pagefor anything that must be complete; a bare--format jsonlredirect silently truncates. - Threads carry no
channelType— joinoriginalChannelIdagainstconversations channels listto get a type. A thread can also switch channels mid-conversation, sooriginalChannelIddescribes where the thread started, not every channel it used. subjectis not a guaranteed field on a thread; always use a// "(no subject)"fallback.textvsrichText: some message types carry formatted content inrichTextrather thantext. Check both fields when extracting excerpts.
FAQ
What does the conversation-history-brief skill do?
Pull full conversation history for a CRM contact — fetch associated threads across all inboxes, retrieve message content, and assemble structured data for account briefs showing channel types, thread statuses, last activity, and key message excerpts.
How do I install conversation-history-brief?
Run npx skills add https://github.com/hubspot/agent-cli-skills --skill conversation-history-brief in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/conversation-history-brief/ (personal) or .claude/skills/conversation-history-brief/ (project).
Which AI agents can use conversation-history-brief?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is conversation-history-brief safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains conversation-history-brief?
It is published by hubspot in hubspot/agent-cli-skills. It has 186 recorded installs.
More from hubspot/agent-cli-skills
ticket-resolution
hubspot/agent-cli-skills
Create, triage, advance, and close HubSpot support tickets — pipeline discovery, contact/company association, priority queues, bulk stage moves, resolution close-out.
crm-lookup
hubspot/agent-cli-skills
Find a specific CRM record by ID, email, domain, or name fragment, and traverse associations for the full account picture.
bulk-operations
hubspot/agent-cli-skills
Foundation patterns for the hubspot CLI — JSONL piping, batch read, pagination, dry-run/digest/confirm for destructive ops, and hubspot history for recovery. Every other skill builds on this one.
crm-data-quality
hubspot/agent-cli-skills
Find incomplete records, normalize field values in bulk, dedupe with hubspot objects merge, and audit custom properties. Builds on bulk-operations for JSONL piping and dry-run/digest/confirm.
workflow-automation
hubspot/agent-cli-skills
List, inspect, create, update, and delete HubSpot workflows (v4 flows API) from the hubspot agent CLI, not the hs developer CLI. Classic v3 contact-based workflows are not covered.
deal-management
hubspot/agent-cli-skills
Run the full deal lifecycle from CLI — discover pipelines/stages, qualify MQLs into deals with associations, advance/reassign in bulk, hunt stalled deals, and close.
Popular business & finance skills
sales-enablement
coreyhaines31/marketingskills
When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),
revops
coreyhaines31/marketingskills
When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.
sales-funnel-blueprint
autonnel/autonnel-skills
Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.
pricing
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.
cross-border-ecommerce
nexscope-ai/ecommerce-skills
Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.
pricing-strategy
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.