> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.casestudies.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.casestudies.dev/_mcp/server.

# HubSpot

> Enrich contacts directly in HubSpot workflows.

## Option 1: Operations Hub Custom Code

1. Go to **Automation** → **Workflows**
2. Create a workflow triggered by "Contact is created"
3. Add a **Custom code** action (requires Operations Hub Professional)
4. Paste:

```javascript
const axios = require('axios');

exports.main = async (event) => {
  const domain = event.inputFields['company_domain'];
  if (!domain) return;

  const res = await axios.get(
    `https://api.casestudies.dev/v1/enrich/${domain}`,
    { headers: { 'X-API-Key': 'YOUR_API_KEY' } }
  );

  const data = res.data;
  const vendors = data.featured_in?.vendors?.map(v => v.vendor.name).join(', ') || '';
  const total = data.featured_in?.total || 0;
  const problem = data.featured_in?.vendors?.[0]?.case_studies?.[0]?.problem || '';
  const outcomes = data.featured_in?.vendors?.[0]?.case_studies?.[0]?.outcomes || '';
  const sourceUrl = data.featured_in?.vendors?.[0]?.case_studies?.[0]?.source_url || '';

  return {
    outputFields: {
      vendor_mentions: total,
      vendors_used: vendors,
      key_problem: problem,
      key_outcome: outcomes,
      source_link: sourceUrl,
    }
  };
};
```

5. Map the output fields to custom contact properties:

| Output field      | HubSpot property | Type             |
| ----------------- | ---------------- | ---------------- |
| `vendor_mentions` | Vendor Mentions  | Number           |
| `vendors_used`    | Tools Used       | Single-line text |
| `key_problem`     | Key Problem      | Multi-line text  |
| `key_outcome`     | Key Outcome      | Multi-line text  |
| `source_link`     | Source Link      | Single-line text |

## Option 2: Use Zapier

See the Zapier integration guide for a no-code alternative.

## Available response fields

See the full field reference in the Enrich endpoint docs.