Skip to content

HubSpot Agent

The hubspot agent connects to the HubSpot CRM API v3 using a private app access token. It fetches contacts, deals, and companies by ID, searches contacts by query, and creates engagement notes. Source data is written as JSON to the workspace.

Use this agent to bring CRM context into your pipelines — pull customer data for personalized workflows, search for accounts before outreach, or log engagement notes after automated interactions.


- name: fetch-contact
agent: hubspot
action: get_contact
sources:
- name: contact.json

The hubspot agent uses phase:standard capability. Every phase declaration requires an action field.

ActionDirectionDescription
get_contactSourceFetch a contact by ID or email
get_dealSourceFetch a deal by ID
get_companySourceFetch a company by ID
searchSourceSearch contacts by query string
add_noteTargetCreate an engagement note on a CRM object
FieldTypeRequiredDescription
namestringYesUnique phase name within the workflow
typestringNoDefaults to "standard"
agentstringYesMust be "hubspot"
depends_onstring[]NoUpstream phases that must complete before this phase runs
actionstringYesOne of: get_contact, get_deal, get_company, search, add_note
sourcesSourceEntry[]For fetch actionsEntries to fetch from HubSpot
target_entriesTargetEntry[]For write actionsEntries to deliver to HubSpot
FieldTypeRequiredDescription
namestringYesOutput filename written to .cliq/files/{phase}/
refstringYesObject ID, email address (get_contact), or search query string (search)
FieldTypeRequiredDescription
namestringYesIdentifier for the operation
refstringYesCRM object ID to attach the note to
filestringYesWorkspace file containing the note content

KeyRequiredDefaultDescription
agents.hubspot.access_tokenYesHubSpot private app access token

Source operation — get_contact:

{
"data": {
"action": "get_contact",
"sources": {
"contact.json": {
"ref": "12345",
"object_type": "contact",
"object_id": "12345",
"properties": ["firstname", "lastname", "email", "company"]
}
},
"targets": {}
},
"text": "## HubSpot Results\n\n✓ Fetched contact.json — contact #12345"
}

Source operation — search:

{
"data": {
"action": "search",
"sources": {
"results.json": {
"ref": "acme",
"object_type": "contact",
"count": 3
}
},
"targets": {}
},
"text": "## HubSpot Results\n\n✓ Searched results.json — 3 contacts matched"
}

Target operation — add_note:

{
"data": {
"action": "add_note",
"sources": {},
"targets": {
"note": {
"ref": "12345",
"object_type": "contact",
"object_id": "12345",
"action_taken": "note_created"
}
}
},
"text": "## HubSpot Results\n\n✓ Added note to contact #12345"
}
FieldLocationDescription
refdata.sources.*, data.targets.*Original ref value (object ID, email, or search query)
object_typedata.sources.*, data.targets.*CRM object type (contact, deal, company)
object_iddata.sources.*, data.targets.*HubSpot object ID
propertiesdata.sources.*List of property names included in the response
countdata.sources.*Number of search results (present on search)
action_takendata.targets.*Action performed (e.g., note_created)

Source responses are saved to .cliq/files/{phase}/{source.name} as JSON. Contact/deal/company data includes all default HubSpot properties.

Reference CRM data in downstream phases:

commands:
- name: report
run: 'echo "Found $(handoff.search-contacts.sources.results.json.count) contacts"'

Example: Pull customer context for support

Section titled “Example: Pull customer context for support”

Fetch a contact and their deal, then hand off to an AI agent with full customer context.

phases:
- name: fetch-customer
agent: hubspot
action: get_contact
sources:
- name: contact.json
- name: fetch-deal
agent: hubspot
action: get_deal
sources:
- name: deal.json
ref: "987654"
- name: draft-response
agent: cursor
role: account-manager
depends_on: [fetch-customer, fetch-deal]

Search for contacts matching a query, then process the results with an analyst agent.

phases:
- name: find-leads
agent: hubspot
action: search
sources:
- name: leads.json
ref: "company:acme lifecycle_stage:lead"
- name: enrich
agent: cursor
role: sales-analyst
depends_on: [find-leads]

Example: Log an engagement note after outreach

Section titled “Example: Log an engagement note after outreach”

After an automated outreach phase completes, log a note on the contact record.

phases:
- name: outreach
agent: cursor
role: outreach-specialist
- name: log-note
agent: hubspot
action: add_note
depends_on: [outreach]
target_entries:
- name: note
ref: "12345"
file: engagement-note.txt

Pull company details and feed them into a reporting pipeline.

phases:
- name: fetch-company
agent: hubspot
action: get_company
sources:
- name: company.json
ref: "555111"
- name: generate-report
agent: cursor
role: analyst
depends_on: [fetch-company]

  1. In HubSpot, go to Settings → Integrations → Private Apps
  2. Click Create a private app
  3. Name it (e.g., cliq-integration) and select the required scopes:
    • crm.objects.contacts.read
    • crm.objects.deals.read
    • crm.objects.companies.read
    • crm.objects.contacts.write (for add_note)
  4. Create the app and copy the access token
Terminal window
echo $HUBSPOT_TOKEN | cliq settings agents.hubspot.access_token --stdin --global
cliq doctor agent hubspot