ElasticFlow
HubAll SkillsBy DepartmentBy RoleBy ToolBy MetricMCPsPublishers
WebsiteLoginSign Up
ElasticFlow

Transform your business with AI-powered workflow automation. One unified platform for all your enterprise needs.

Follow us

Platform

  • Features
  • Benefits
  • Use Cases
  • Workflow Library

Use Cases

  • Sales
  • Marketing
  • Finance & Legal
  • HR

Catalogue

  • Departments
  • Roles
  • Tools
  • Metrics
  • Platforms

Growth

  • Referral Program
  • Partners

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Acceptable Use
  • Security
  • SLA

© 2026 ElasticFlow. All rights reserved.

ElasticFlow
HubAll SkillsBy DepartmentBy RoleBy ToolBy MetricMCPsPublishers
WebsiteLoginSign Up
ElasticFlow

Transform your business with AI-powered workflow automation. One unified platform for all your enterprise needs.

Follow us

Platform

  • Features
  • Benefits
  • Use Cases
  • Workflow Library

Use Cases

  • Sales
  • Marketing
  • Finance & Legal
  • HR

Catalogue

  • Departments
  • Roles
  • Tools
  • Metrics
  • Platforms

Growth

  • Referral Program
  • Partners

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Acceptable Use
  • Security
  • SLA

© 2026 ElasticFlow. All rights reserved.

ElasticFlow
HubAll SkillsBy DepartmentBy RoleBy ToolBy MetricMCPsPublishers
WebsiteLoginSign Up
  1. Hub
  2. All Skills
  3. HubSpot CRM
AI SkillUse HubSpot dataSales

Use HubSpot CRM records as evidence for sales, pipeline, and customer analysis. — Claude Skill

A Claude Skill for Claude Code by FunnelEnvy — run /hubspot-crm in Claude·Updated Jun 14, 2026·vmain@1804741

Compatible withGChatGPTClaudeClaudeCCClaude CodeXCodex / Codex CLICursorCursorGeminiGemini

Connects HubSpot contacts, companies, lists, and deal fields to business workflows so teams can pull CRM evidence, check fields, and sync cleanly before analysis.

  • Pulls HubSpot contact, company, list, and deal context into analysis workflows.
  • Explains which CRM fields are needed before a sales or competitive question can be answered.
  • Helps avoid bad analysis caused by missing owner, lifecycle stage, deal reason, or segment data.
  • Keeps API and sync limitations visible for operators who maintain the CRM connection.
YouToday

Teams export HubSpot data and start analysis before checking whether key fields are complete.

With /hubspot-crm

Run /hubspot-crm to define the records, fields, filters, and hygiene checks needed before analysis.

1 State the business question2 Map HubSpot objects and fields3 Check data quality4 Analyze with caveats

Who this is for

Revenue Operations Manager

Turn HubSpot data into reliable inputs for sales and pipeline analysis.

See skills for this role
Sales Manager

Understand which CRM fields support competitive and win/loss decisions.

See skills for this role

What it does

Win/loss evidence

Use HubSpot deal notes and fields to support competitive analysis.

Pipeline segmentation

Filter opportunities by segment, competitor, source, or lifecycle stage.

CRM hygiene before analysis

Find missing owners, reasons, stages, or fields that would distort a report.

How it works

1

Define the business question and the HubSpot records needed to answer it.

2

Identify required objects, filters, fields, owner data, lifecycle stages, and date ranges.

3

Pull or paste exported HubSpot evidence into the analysis workflow.

4

Check for missing, duplicate, or stale fields before using the data.

5

Return a business-ready readout plus any CRM cleanup needed.

Input options

Business question

The sales, pipeline, customer, or competitive question to answer.

Example

What the user pastes
Need to analyze competitive losses from HubSpot for Q2.
Objects available: deals, companies, contacts.
Fields:
- dealstage
- closedate
- competitor_name
- closed_lost_reason
- amount
- owner
- company_size
- segment
Known issue: some deals have competitor_name empty but notes mention LearnPro or GuidePilot.
Need: field checklist, filters, export plan, and warnings before using this data in a battlecard refresh.
Useful result
CRM readout
Use closed-lost deals from Q2 where competitor_name is LearnPro or GuidePilot, plus deals where notes mention those names. Segment by company_size and owner before drawing conclusions.
Required HubSpot fields
| Field | Why it matters | Risk if missing |
|---|---|---|
| competitor_name | Main grouping for battlecard refresh | Losses may be undercounted |
| closed_lost_reason | Explains why deals were lost | Output becomes anecdotal |
| segment/company_size | Shows which market is affected | Enterprise and SMB patterns get mixed |
| amount | Helps prioritize high-value losses | Small deals may dominate the story |
| owner | Enables follow-up with seller | Evidence cannot be validated |
Export plan
Export closed-lost Q2 deals with required fields, then add a notes keyword pass for LearnPro and GuidePilot. Keep the notes extract separate from structured competitor_name so the team can see which findings are inferred.
Data warnings
Do not report exact competitor loss rate until empty competitor_name fields are reviewed. If closed_lost_reason is generic, use call notes or owner follow-up before turning it into battlecard guidance.
Next action
Create a CRM cleanup task: require competitor_name and closed_lost_reason for competitive closed-lost deals above $25k ARR.

Metrics this improves

CRM Data Capture Rate
Improves completeness of CRM fields needed for analysis.
Sales
Pipeline Hygiene
Flags missing or inconsistent records before reporting.
Sales

Works with

Google Sheets
manual

Review exported HubSpot records and cleanup lists.

Slack
manual

Share data quality warnings and follow-up tasks with sales owners.

HubSpot
manual

Primary CRM source for contacts, companies, lists, deals, owners, and notes.

Want to use HubSpot CRM?

Choose how to get started.

Run in Claude Code
Free. Open source.

Install and run this skill locally on your computer.

1
Install Claude Code

Open a terminal on your computer and paste this command:

2
Install the skill

This downloads the skill with all its files to your computer:

Add -g at the end to make it available in all your projects.

3
Run it

Start Claude Code, then type the command:

then
View source on GitHub
Use on ElasticFlow
Team and collaboration features

Run skills from your browser. Share results, manage access, collaborate with your team. No terminal needed.

Free 14-day trial. Cancel anytime.

View on GitHub

HubSpot CRM Integration

Sync contacts and lists to HubSpot using the REST API.

Environment Variables

HUBSPOT_API_TOKEN="pat-na1-..."  # Private App token from HubSpot

Quick Start

import os
import json
from urllib.request import Request, urlopen
from urllib.error import HTTPError

class HubSpotClient:
    """Simple HubSpot API client."""

    def __init__(self):
        self.token = os.environ.get('HUBSPOT_API_TOKEN')
        if not self.token:
            raise ValueError("HUBSPOT_API_TOKEN environment variable not set")
        self.base_url = "https://api.hubapi.com"

    def _request(self, method: str, endpoint: str, data: dict = None) -> dict:
        url = f"{self.base_url}{endpoint}"
        headers = {
            "Authorization": f"Bearer {self.token}",
            "Content-Type": "application/json"
        }
        body = json.dumps(data).encode('utf-8') if data else None
        request = Request(url, data=body, headers=headers, method=method)

        with urlopen(request, timeout=30) as response:
            return json.loads(response.read().decode('utf-8'))

Create Static List

def create_static_list(client, name: str) -> str:
    """Create a static list for contacts. Returns list ID."""
    payload = {
        "name": name,
        "objectTypeId": "0-1",  # REQUIRED: 0-1 = contacts
        "processingType": "MANUAL"
    }

    result = client._request("POST", "/crm/v3/lists", payload)
    # Response is nested: {"list": {"listId": "..."}}
    list_data = result.get("list", result)
    list_id = list_data.get("listId")

    print(f"✅ Created list: {name} (ID: {list_id})")
    return list_id

Search Contact by Email

def search_contact(client, email: str) -> str | None:
    """Find contact by email. Returns contact ID or None."""
    payload = {
        "filterGroups": [{
            "filters": [{
                "propertyName": "email",
                "operator": "EQ",
                "value": email
            }]
        }],
        "properties": ["email"],
        "limit": 1
    }

    result = client._request("POST", "/crm/v3/objects/contacts/search", payload)
    results = result.get("results", [])
    return results[0]["id"] if results else None

Create Contact

def create_contact(client, email: str, firstname: str = None, lastname: str = None) -> str:
    """Create a new contact with email only (vanilla upload).

    Only uses standard HubSpot properties (email, firstname, lastname)
    to avoid errors from missing custom properties in the target account.
    """
    properties = {"email": email}
    if firstname:
        properties["firstname"] = firstname
    if lastname:
        properties["lastname"] = lastname

    result = client._request("POST", "/crm/v3/objects/contacts", {"properties": properties})
    return result["id"]

Important: Do NOT pass arbitrary CSV columns as properties. HubSpot will reject any property names that don't exist in the target account. Only use standard fields (email, firstname, lastname) unless you've confirmed custom properties exist.

Add Contacts to List

def add_to_list(client, list_id: str, contact_ids: list[str]):
    """Add contacts to a static list. Batches in groups of 100."""
    endpoint = f"/crm/v3/lists/{list_id}/memberships/add"

    batch_size = 100
    total_added = 0

    for i in range(0, len(contact_ids), batch_size):
        batch = contact_ids[i:i + batch_size]
        # IMPORTANT: Payload is a simple array, NOT {"recordIdsToAdd": [...]}
        result = client._request("PUT", endpoint, batch)
        added = len(result.get("recordsIdsAdded", []))
        total_added += added
        print(f"  Added batch: {added} contacts")

    print(f"✅ Added {total_added} total contacts to list")

Full Upload Flow

def upload_users_to_hubspot(emails: list[str], list_name: str) -> str:
    """Upload a list of email addresses to HubSpot."""
    client = HubSpotClient()

    # Create list
    list_id = create_static_list(client, list_name)

    # Find or create contacts
    contact_ids = []
    for email in emails:
        contact_id = search_contact(client, email)
        if not contact_id:
            contact_id = create_contact(client, email)
        contact_ids.append(contact_id)

    # Add to list
    add_to_list(client, list_id, contact_ids)

    print(f"\n✅ Complete!")
    print(f"   List: https://app.hubspot.com/contacts/lists/{list_id}")

    return list_id

Usage Example

# Upload at-risk users from analysis
at_risk_emails = [
    "[email protected]",
    "[email protected]",
    "[email protected]"
]

list_id = upload_users_to_hubspot(
    emails=at_risk_emails,
    list_name="At-Risk Trial Users - Dec 2024"
)

Using the Integration Script

For CSV files, use the provided script:

.venv/bin/python demos/04-trial-to-paid/scripts/hubspot_integration.py \
  path/to/users.csv \
  "List Name Here"

The CSV must have an email column.

API Gotchas

  1. List creation requires objectTypeId: Always include "objectTypeId": "0-1" for contacts
  2. Response is nested: List ID is at result["list"]["listId"], not result["listId"]
  3. Add-to-list payload format: Use simple array ["id1", "id2"], NOT {"recordIdsToAdd": [...]}
  4. Contact IDs are strings: Even though they look numeric, treat them as strings
  5. Batch limit: Add contacts in batches of 100 max

Error Handling

from urllib.error import HTTPError

try:
    result = client._request("POST", endpoint, payload)
except HTTPError as e:
    error_body = e.read().decode('utf-8')
    print(f"HubSpot API error: {e.code}")
    print(f"  {error_body}")

Getting Your HubSpot Private App Token

  1. Go to Settings (gear icon) in HubSpot
  2. Navigate to Integrations > Private Apps
  3. Click Create a private app
  4. Give it a name (e.g., "AI Agent Integration")
  5. Under Scopes, enable:
    • crm.lists.read
    • crm.lists.write
    • crm.objects.contacts.read
    • crm.objects.contacts.write
  6. Click Create app and copy the token
  7. Set as HUBSPOT_API_TOKEN environment variable

Reference documents


name: hubspot-crm description: Use when syncing contacts or lists to HubSpot CRM. Automatically uses HUBSPOT_API_TOKEN from environment.

HubSpot CRM Integration

Sync contacts and lists to HubSpot using the REST API.

Environment Variables

HUBSPOT_API_TOKEN="pat-na1-..."  # Private App token from HubSpot

Quick Start

import os
import json
from urllib.request import Request, urlopen
from urllib.error import HTTPError

class HubSpotClient:
    """Simple HubSpot API client."""

    def __init__(self):
        self.token = os.environ.get('HUBSPOT_API_TOKEN')
        if not self.token:
            raise ValueError("HUBSPOT_API_TOKEN environment variable not set")
        self.base_url = "https://api.hubapi.com"

    def _request(self, method: str, endpoint: str, data: dict = None) -> dict:
        url = f"{self.base_url}{endpoint}"
        headers = {
            "Authorization": f"Bearer {self.token}",
            "Content-Type": "application/json"
        }
        body = json.dumps(data).encode('utf-8') if data else None
        request = Request(url, data=body, headers=headers, method=method)

        with urlopen(request, timeout=30) as response:
            return json.loads(response.read().decode('utf-8'))

Create Static List

def create_static_list(client, name: str) -> str:
    """Create a static list for contacts. Returns list ID."""
    payload = {
        "name": name,
        "objectTypeId": "0-1",  # REQUIRED: 0-1 = contacts
        "processingType": "MANUAL"
    }

    result = client._request("POST", "/crm/v3/lists", payload)
    # Response is nested: {"list": {"listId": "..."}}
    list_data = result.get("list", result)
    list_id = list_data.get("listId")

    print(f"✅ Created list: {name} (ID: {list_id})")
    return list_id

Search Contact by Email

def search_contact(client, email: str) -> str | None:
    """Find contact by email. Returns contact ID or None."""
    payload = {
        "filterGroups": [{
            "filters": [{
                "propertyName": "email",
                "operator": "EQ",
                "value": email
            }]
        }],
        "properties": ["email"],
        "limit": 1
    }

    result = client._request("POST", "/crm/v3/objects/contacts/search", payload)
    results = result.get("results", [])
    return results[0]["id"] if results else None

Create Contact

def create_contact(client, email: str, firstname: str = None, lastname: str = None) -> str:
    """Create a new contact with email only (vanilla upload).

    Only uses standard HubSpot properties (email, firstname, lastname)
    to avoid errors from missing custom properties in the target account.
    """
    properties = {"email": email}
    if firstname:
        properties["firstname"] = firstname
    if lastname:
        properties["lastname"] = lastname

    result = client._request("POST", "/crm/v3/objects/contacts", {"properties": properties})
    return result["id"]

Important: Do NOT pass arbitrary CSV columns as properties. HubSpot will reject any property names that don't exist in the target account. Only use standard fields (email, firstname, lastname) unless you've confirmed custom properties exist.

Add Contacts to List

def add_to_list(client, list_id: str, contact_ids: list[str]):
    """Add contacts to a static list. Batches in groups of 100."""
    endpoint = f"/crm/v3/lists/{list_id}/memberships/add"

    batch_size = 100
    total_added = 0

    for i in range(0, len(contact_ids), batch_size):
        batch = contact_ids[i:i + batch_size]
        # IMPORTANT: Payload is a simple array, NOT {"recordIdsToAdd": [...]}
        result = client._request("PUT", endpoint, batch)
        added = len(result.get("recordsIdsAdded", []))
        total_added += added
        print(f"  Added batch: {added} contacts")

    print(f"✅ Added {total_added} total contacts to list")

Full Upload Flow

def upload_users_to_hubspot(emails: list[str], list_name: str) -> str:
    """Upload a list of email addresses to HubSpot."""
    client = HubSpotClient()

    # Create list
    list_id = create_static_list(client, list_name)

    # Find or create contacts
    contact_ids = []
    for email in emails:
        contact_id = search_contact(client, email)
        if not contact_id:
            contact_id = create_contact(client, email)
        contact_ids.append(contact_id)

    # Add to list
    add_to_list(client, list_id, contact_ids)

    print(f"\n✅ Complete!")
    print(f"   List: https://app.hubspot.com/contacts/lists/{list_id}")

    return list_id

Usage Example

# Upload at-risk users from analysis
at_risk_emails = [
    "[email protected]",
    "[email protected]",
    "[email protected]"
]

list_id = upload_users_to_hubspot(
    emails=at_risk_emails,
    list_name="At-Risk Trial Users - Dec 2024"
)

Using the Integration Script

For CSV files, use the provided script:

.venv/bin/python demos/04-trial-to-paid/scripts/hubspot_integration.py \
  path/to/users.csv \
  "List Name Here"

The CSV must have an email column.

API Gotchas

  1. List creation requires objectTypeId: Always include "objectTypeId": "0-1" for contacts
  2. Response is nested: List ID is at result["list"]["listId"], not result["listId"]
  3. Add-to-list payload format: Use simple array ["id1", "id2"], NOT {"recordIdsToAdd": [...]}
  4. Contact IDs are strings: Even though they look numeric, treat them as strings
  5. Batch limit: Add contacts in batches of 100 max

Error Handling

from urllib.error import HTTPError

try:
    result = client._request("POST", endpoint, payload)
except HTTPError as e:
    error_body = e.read().decode('utf-8')
    print(f"HubSpot API error: {e.code}")
    print(f"  {error_body}")

Getting Your HubSpot Private App Token

  1. Go to Settings (gear icon) in HubSpot
  2. Navigate to Integrations > Private Apps
  3. Click Create a private app
  4. Give it a name (e.g., "AI Agent Integration")
  5. Under Scopes, enable:
    • crm.lists.read
    • crm.lists.write
    • crm.objects.contacts.read
    • crm.objects.contacts.write
  6. Click Create app and copy the token
  7. Set as HUBSPOT_API_TOKEN environment variable
ElasticFlow

Transform your business with AI-powered workflow automation. One unified platform for all your enterprise needs.

Follow us

Platform

  • Features
  • Benefits
  • Use Cases
  • Workflow Library

Use Cases

  • Sales
  • Marketing
  • Finance & Legal
  • HR

Catalogue

  • Departments
  • Roles
  • Tools
  • Metrics
  • Platforms

Growth

  • Referral Program
  • Partners

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Acceptable Use
  • Security
  • SLA

© 2026 ElasticFlow. All rights reserved.