hubspot

TotalClaw 作者 totalclaw

通过 HubSpot API 查询和管理 HubSpot CRM 数据。当您需要搜索或管理联系人、公司、交易、票证或管道时使用。支持创建、更新和关联 CRM 对象。直接调用 api.hubapi.com,无需第三方代理。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~codeninja23-native-hubspot
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~codeninja23-native-hubspot/file -o codeninja23-native-hubspot.md
# HubSpot

Interact with HubSpot CRM directly via the HubSpot API (`api.hubapi.com`).

## Setup (one-time)

1. In HubSpot: Settings → Integrations → Private Apps → Create a private app
2. Give it scopes: `crm.objects.contacts.read`, `crm.objects.contacts.write`, `crm.objects.companies.read`, `crm.objects.companies.write`, `crm.objects.deals.read`, `crm.objects.deals.write`, `tickets`
3. Copy the access token
4. Set environment variable:
   ```
   HUBSPOT_TOKEN=pat-na1-...
   ```

## Queries

### Search contacts
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search contacts --query "john"
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search contacts --email "john@example.com"
```

### List contacts
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list contacts --limit 20
```

### Get a specific object
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py get contacts 12345
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py get companies 67890
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py get deals 11111
```

### List companies
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list companies --limit 20
```

### Search companies
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search companies --query "Acme"
```

### List deals
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list deals --limit 20
```

### Search deals
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search deals --query "enterprise"
```

### List tickets
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list tickets --limit 20
```

### Create a contact
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py create contacts --email "new@example.com" --firstname "Jane" --lastname "Doe"
```

### Create a company
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py create companies --name "Acme Corp" --domain "acme.com"
```

### Create a deal
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py create deals --dealname "Enterprise Plan" --amount 50000 --pipeline default --dealstage appointmentscheduled
```

### Update an object
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py update contacts 12345 --email "new@example.com" --phone "+1234567890"
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py update deals 11111 --dealstage closedwon --amount 75000
```

### Associate objects
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py associate contacts 12345 companies 67890
```

### List pipelines
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py pipelines deals
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py pipelines tickets
```

### List owners
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py owners
```

---

## 中文说明

# HubSpot

通过 HubSpot API(`api.hubapi.com`)直接与 HubSpot CRM 交互。

## 设置(一次性)

1. 在 HubSpot 中:Settings → Integrations → Private Apps → Create a private app
2. 为其授予以下范围:`crm.objects.contacts.read`、`crm.objects.contacts.write`、`crm.objects.companies.read`、`crm.objects.companies.write`、`crm.objects.deals.read`、`crm.objects.deals.write`、`tickets`
3. 复制访问令牌
4. 设置环境变量:
   ```
   HUBSPOT_TOKEN=pat-na1-...
   ```

## 查询

### 搜索联系人
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search contacts --query "john"
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search contacts --email "john@example.com"
```

### 列出联系人
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list contacts --limit 20
```

### 获取特定对象
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py get contacts 12345
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py get companies 67890
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py get deals 11111
```

### 列出公司
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list companies --limit 20
```

### 搜索公司
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search companies --query "Acme"
```

### 列出交易
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list deals --limit 20
```

### 搜索交易
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py search deals --query "enterprise"
```

### 列出票证
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py list tickets --limit 20
```

### 创建联系人
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py create contacts --email "new@example.com" --firstname "Jane" --lastname "Doe"
```

### 创建公司
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py create companies --name "Acme Corp" --domain "acme.com"
```

### 创建交易
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py create deals --dealname "Enterprise Plan" --amount 50000 --pipeline default --dealstage appointmentscheduled
```

### 更新对象
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py update contacts 12345 --email "new@example.com" --phone "+1234567890"
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py update deals 11111 --dealstage closedwon --amount 75000
```

### 关联对象
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py associate contacts 12345 companies 67890
```

### 列出管道
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py pipelines deals
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py pipelines tickets
```

### 列出所有者
```bash
python3 /mnt/skills/user/hubspot/scripts/hubspot_query.py owners
```