> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/recipe/crm/hubspot-custom-contacts.md).

# HubSpotのコンタクトデータを取得する

{% hint style="success" %}

### このレシピについて

このレシピは、[CRM API | コンタクト](https://developers.hubspot.jp/docs/api/crm/contacts) を参考に記述されています。
{% endhint %}

## **HubSpotの「コンタクトデータ」とは**

HubSpot に登録された、自社とやり取りする個人に関する情報です。\
（参考：[CRM API | コンタクト](https://developers.hubspot.jp/docs/api/crm/contacts)）

HubSpot の CRM API を利用することで、HubSpot に登録された**コンタクトデータ**の一覧を取得できます。

### **HubSpotの「コンタクトデータ」の構造**

```json
{
  "id": "1",
  "properties": {
    "createdate": "2022-11-11T02:53:00.214Z",
    "email": "[email protected]",
    "firstname": "Maria",
    "hs_object_id": "1",
    "lastmodifieddate": "2023-01-31T04:40:28.639Z",
    "lastname": "Johnson (Sample Contact)"
  },
  "createdAt": "2022-11-11T02:53:00.214Z",
  "updatedAt": "2023-01-31T04:40:28.639Z",
  "archived": false
}
```

## **Anyflow Embedで取得する**

Anyflow Embed で HubSpot のコンタクトデータを取得する手順を紹介します。

HubSpot のコンタクトデータを**スプレッドシートに一括追加する**というシンプルなソリューションを作成し、コンタクトに含まれるデータを把握します。

<figure><img src="https://files.readme.io/0540a15-CleanShot_2024-05-03_at_16.19.172x.png" alt=""><figcaption></figcaption></figure>

### **1.Clickトリガーを設定する**

Clickトリガーを設定します。

<figure><img src="https://files.readme.io/b9650b7-image.png" alt=""><figcaption></figcaption></figure>

### **2.HubSpot コネクタを設定する**

HubSpot コネクタを追加します。

<figure><img src="https://files.readme.io/c1e1552-CleanShot_2024-04-13_at_11.12.372x.png" alt=""><figcaption></figcaption></figure>

### **jison3.HubSpot のカスタムアクションを設定する**

ソリューションエディタに戻り、HubSpotコネクタを以下の通りに設定します。

<table><thead><tr><th width="328.97265625">設定項目名</th><th>設定値</th></tr></thead><tbody><tr><td>カスタムアクション名</td><td>データを取得する</td></tr><tr><td>HTTPメソッド</td><td>GET</td></tr><tr><td>リクエストパス</td><td>/crm/v3/objects/contacts</td></tr><tr><td>リクエストヘッダー</td><td>※ 設定不要</td></tr><tr><td>リクエストタイプ</td><td>※ 設定不要</td></tr><tr><td>レスポンスヘッダー定義</td><td>※ 設定不要</td></tr><tr><td>レスポンスタイプ</td><td>json</td></tr></tbody></table>

また、「レスポンスボディ定義」には以下の設定を行います。

```json
{
  "results": [
    {
      "id": "string",
      "properties": {
        "email": "string",
        "firstname": "string",
        "lastname": "string"
      },
      "createdAt": "2024-04-15T00:14:10.990Z"
    }
  ]
}
```

「element」の名前は「contact」に変更しておきます。

<figure><img src="https://files.readme.io/ced85ad-image.png" alt="" width="563"><figcaption></figcaption></figure>

以下が設定後のイメージです。

<figure><img src="https://files.readme.io/3526584-CleanShot_2024-05-03_at_16.22.042x.png" alt="" width="563"><figcaption></figcaption></figure>

### **4.スプレッドシートの列名を設定する**

スプレッドシートコネクタを追加し、以下の通りに設定を行います。

<table><thead><tr><th width="290.51171875">設定項目名</th><th>設定値</th></tr></thead><tbody><tr><td>アクション</td><td>1行追加</td></tr><tr><td>スプレッドシートID</td><td>任意のスプレッドシートID</td></tr><tr><td>シートID</td><td>任意のシートID</td></tr></tbody></table>

<figure><img src="https://files.readme.io/677257c-_2024-02-26_17.45.08.png" alt=""><figcaption></figcaption></figure>

「ヘッダーの列名」は以下の通りに設定します。

```
id
email
firstname
lastname
createdAt
```

「行データ」にも同じ様に設定します。

<figure><img src="https://files.readme.io/46fc07e-CleanShot_2024-05-03_at_16.22.392x.png" alt="" width="563"><figcaption></figcaption></figure>

### **5.スプレッドシートに一括追記する**

スプレッドシートコネクタを追加し、以下の通りに設定を行います。

| 設定項目名      | 設定値           |
| ---------- | ------------- |
| アクション      | 行を一括追加        |
| スプレッドシートID | 任意のスプレッドシートID |
| シートID      | 任意のシートID      |

「ヘッダーの列名」は以下の通りに設定します。

```
id
email
firstname
lastname
createdAt
```

「リストソース」は以下の通りに設定します。

<figure><img src="https://files.readme.io/75d7fd3-CleanShot_2024-05-03_at_16.23.572x.png" alt=""><figcaption></figcaption></figure>

「要素フィールド」は以下の通りに設定します。（「i番目のcontacts」から項目を選択します。）

<figure><img src="https://files.readme.io/312cd07-CleanShot_2024-05-03_at_16.24.542x.png" alt=""><figcaption></figcaption></figure>

### **6.ウィザードを設定する**

必要な認証をウィザードに追加します。

### **7.テストを行う**

テストを行うと、スプレッドシートにデータが追加されていることがわかります。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/recipe/crm/hubspot-custom-contacts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
