> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pubrio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 例：求人情報の追跡

> company_firstとsignal_firstの検出モードを使用した求人情報モニタリングの完全なウォークスルー — コピー可能なコード付き。

このガイドでは2つの実際のシナリオを説明します。すべてのコードブロックはコピー、ペースト、実行が可能です — `YOUR_API_KEY` を実際のキーに置き換えるだけです。

<Tabs>
  <Tab title="カンパニーファースト：OpenAIを追跡">
    ## シナリオ：OpenAIが新しい求人を投稿した時にモニタリング

    OpenAIが求人を投稿した際にすぐに通知を受け取り、エンジニアリングリーダーシップの連絡先を自動的に取得したい場合。

    ### モニターを作成

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.pubrio.com/monitors/create \
        -H "Content-Type: application/json" \
        -H "pubrio-api-key: YOUR_API_KEY" \
        -d '{
          "name": "OpenAI Job Tracker",
          "detection_mode": "company_first",
          "signal_types": ["jobs"],
          "signal_filters": [
            {
              "signal_type": "jobs",
              "filters": {
                "locations": ["US"]
              }
            }
          ],
          "companies": [
            "67c4696b-b7b0-46b5-b2af-9f434543661e"
          ],
          "is_company_enrichment": true,
          "is_people_enrichment": true,
          "people_enrichment_configs": [
            {
              "max_people_to_return": 5,
              "people_contact_types": ["email-work"],
              "filters": {
                "management_levels": ["director", "vp"],
                "departments": ["master_engineering"]
              }
            }
          ],
          "destination_type": "webhook",
          "destination_config": {
            "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
            "headers": {
              "Authorization": "Bearer your-secret-token"
            }
          },
          "max_records_per_trigger": 5,
          "profile_id": 1
        }'
      ```

      ```python Python theme={null}
      import requests

      response = requests.post(
          "https://api.pubrio.com/monitors/create",
          headers={
              "Content-Type": "application/json",
              "pubrio-api-key": "YOUR_API_KEY"
          },
          json={
              "name": "OpenAI Job Tracker",
              "detection_mode": "company_first",
              "signal_types": ["jobs"],
              "signal_filters": [
                  {
                      "signal_type": "jobs",
                      "filters": {
                          "locations": ["US"]
                      }
                  }
              ],
              "companies": [
                  "67c4696b-b7b0-46b5-b2af-9f434543661e"
              ],
              "is_company_enrichment": True,
              "is_people_enrichment": True,
              "people_enrichment_configs": [
                  {
                      "max_people_to_return": 5,
                      "people_contact_types": ["email-work"],
                      "filters": {
                          "management_levels": ["director", "vp"],
                          "departments": ["master_engineering"]
                      }
                  }
              ],
              "destination_type": "webhook",
              "destination_config": {
                  "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
                  "headers": {
                      "Authorization": "Bearer your-secret-token"
                  }
              },
              "max_records_per_trigger": 5,
              "profile_id": 1
          }
      )

      data = response.json()
      print(f"Monitor created: {data['data']['monitor_id']}")
      print(f"Signature: {data['data']['signature']}")
      ```

      ```javascript Node.js theme={null}
      const response = await fetch("https://api.pubrio.com/monitors/create", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "pubrio-api-key": "YOUR_API_KEY"
        },
        body: JSON.stringify({
          name: "OpenAI Job Tracker",
          detection_mode: "company_first",
          signal_types: ["jobs"],
          signal_filters: [
            {
              signal_type: "jobs",
              filters: {
                locations: ["US"]
              }
            }
          ],
          companies: [
            "67c4696b-b7b0-46b5-b2af-9f434543661e"
          ],
          is_company_enrichment: true,
          is_people_enrichment: true,
          people_enrichment_configs: [
            {
              max_people_to_return: 5,
              people_contact_types: ["email-work"],
              filters: {
                management_levels: ["director", "vp"],
                departments: ["master_engineering"]
              }
            }
          ],
          destination_type: "webhook",
          destination_config: {
            webhook_url: "https://usewebhook.com/YOUR_WEBHOOK_ID",
            headers: {
              Authorization: "Bearer your-secret-token"
            }
          },
          max_records_per_trigger: 5,
          profile_id: 1
        })
      });

      const data = await response.json();
      console.log("Monitor created:", data.data.monitor_id);
      console.log("Signature:", data.data.signature);
      ```
    </CodeGroup>

    **動作内容：**

    * OpenAI（`companies: ["67c4696b-..."]`）の米国の新規求人をモニタリング
    * 企業データをエンリッチメントし、最大5人のディレクター/VPレベルのエンジニアリング連絡先を検索
    * トリガーごとに最大5件のレコードをウェブフックに配信
    * その他の設定はデフォルト値を使用（リアルタイムのフリクエンシー、1日500回の上限など）

    <Note>
      `company_first` モードでは、通常 `companies`（domain\_search\_ids）、`domains`、または `linkedin_urls` のいずれか1つとシグナルフィルターのみ必要です。`company_filters` はオプションです — ウォッチリストをより広い企業条件と組み合わせたい場合に第2のフィルタリングレイヤーを追加します。
    </Note>

    ### すぐにテスト

    スケジュールされたスキャンを待たずに、手動実行をトリガーしてすべてが正常に動作することを確認してください。`tried_at` に過去のタイムスタンプを使用してデータが利用可能であることを確認します（現在時刻を使用すると、新しいシグナルがまだ現れていない場合に0件の結果が返される可能性があります）：

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.pubrio.com/monitors/process/try \
        -H "Content-Type: application/json" \
        -H "pubrio-api-key: YOUR_API_KEY" \
        -d '{
          "monitor_id": "YOUR_MONITOR_ID",
          "tried_at": "2026-01-01T00:00:00.000Z",
          "profile_id": 1
        }'
      ```
    </CodeGroup>

    <Info>
      手動トリガーはスケジュールトリガーと同様にクレジットを消費します。テストで代表的な結果を得るために、`tried_at` に最近の過去の日付を使用してください。
    </Info>

    ### 結果を確認

    数秒後、[usewebhook.com](https://usewebhook.com)でウェブフックURLをチェックしてペイロードを確認してください。ログでも検証できます：

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.pubrio.com/monitors/statistics/logs \
        -H "Content-Type: application/json" \
        -H "pubrio-api-key: YOUR_API_KEY" \
        -d '{
          "profile_id": 1,
          "monitor_id": "YOUR_MONITOR_ID",
          "page": 1,
          "per_page": 5
        }'
      ```
    </CodeGroup>

    各ログエントリにはステータス、シグナル/企業/人物の数、クレジット使用量、処理時間が表示されます。
  </Tab>

  <Tab title="シグナルファースト：AI採用を発見">
    ## シナリオ：AI/ML職種を採用している企業を発見

    これまで追跡していたかどうかに関係なく、積極的にAIチームを構築している企業を見つけたい場合。これはプロスペクティングのユースケースです。

    ### モニターを作成

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.pubrio.com/monitors/create \
        -H "Content-Type: application/json" \
        -H "pubrio-api-key: YOUR_API_KEY" \
        -d '{
          "name": "AI Hiring Discovery",
          "detection_mode": "signal_first",
          "signal_types": ["jobs"],
          "signal_filters": [
            {
              "signal_type": "jobs",
              "filters": {
                "titles": ["Machine Learning", "AI Engineer", "Data Scientist"],
                "locations": ["US"]
              }
            }
          ],
          "company_filters": {
            "employees": [[201, 500], [501, 1000], [1001, 5000]]
          },
          "is_company_enrichment": true,
          "is_people_enrichment": true,
          "people_enrichment_configs": [
            {
              "max_people_to_return": 3,
              "people_contact_types": ["email-work"],
              "filters": {
                "management_levels": ["founder", "c_suite", "vp"]
              }
            }
          ],
          "destination_type": "webhook",
          "destination_config": {
            "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
            "body": {
              "pipeline": "ai-prospecting"
            }
          },
          "max_records_per_trigger": 10,
          "profile_id": 1
        }'
      ```

      ```python Python theme={null}
      import requests

      response = requests.post(
          "https://api.pubrio.com/monitors/create",
          headers={
              "Content-Type": "application/json",
              "pubrio-api-key": "YOUR_API_KEY"
          },
          json={
              "name": "AI Hiring Discovery",
              "detection_mode": "signal_first",
              "signal_types": ["jobs"],
              "signal_filters": [
                  {
                      "signal_type": "jobs",
                      "filters": {
                          "titles": ["Machine Learning", "AI Engineer", "Data Scientist"],
                          "locations": ["US"]
                      }
                  }
              ],
              "company_filters": {
                  "employees": [[201, 500], [501, 1000], [1001, 5000]]
              },
              "is_company_enrichment": True,
              "is_people_enrichment": True,
              "people_enrichment_configs": [
                  {
                      "max_people_to_return": 3,
                      "people_contact_types": ["email-work"],
                      "filters": {
                          "management_levels": ["founder", "c_suite", "vp"]
                      }
                  }
              ],
              "destination_type": "webhook",
              "destination_config": {
                  "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
                  "body": {
                      "pipeline": "ai-prospecting"
                  }
              },
              "max_records_per_trigger": 10,
              "profile_id": 1
          }
      )

      data = response.json()
      print(f"Monitor created: {data['data']['monitor_id']}")
      ```
    </CodeGroup>

    **動作内容：**

    * 米国のAI/ML求人をスキャン
    * **グローバル企業フィルター**が結果を中規模企業（従業員201〜5,000人）に絞り込みます — これがシグナルと企業条件を組み合わせるパワーです
    * 企業をエンリッチメントし、最大3人のファウンダー/Cスイート/VP連絡先を検索
    * ウェブフックハンドラーでのルーティング用にカスタム `pipeline` フィールドをペイロードに追加
    * デフォルトでリアルタイムフリクエンシー

    ### すぐにテスト

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.pubrio.com/monitors/process/try \
        -H "Content-Type: application/json" \
        -H "pubrio-api-key: YOUR_API_KEY" \
        -d '{
          "monitor_id": "YOUR_MONITOR_ID",
          "tried_at": "2026-01-01T00:00:00.000Z",
          "profile_id": 1
        }'
      ```
    </CodeGroup>

    <Info>
      手動トリガーはクレジットを消費します。テストで代表的なデータを得るために、`tried_at` に最近の過去の日付を使用してください — 現在時刻を使用すると、その瞬間に新しいシグナルが現れていない場合に0件の結果が返される可能性があります。
    </Info>

    ### 受信内容

    [usewebhook.com](https://usewebhook.com)をチェックしてください — シグナルを主要構造とした `signal_first` ペイロードが表示されます。`destination_config.body` からのカスタム `pipeline` フィールドがルートレベルにあることに注目してください：

    ```json theme={null}
    {
      "monitor": { ... },
      "metadata": {
        "total_signals": 5,
        "total_companies": 4,
        "total_people": 10
      },
      "triggered_at": "2026-04-06T14:30:00.000Z",
      "signals": [
        {
          "signal_type": "jobs",
          "signal": { ... },
          "companies": [
            {
              "company_name": "...",
              "domain": "...",
              "company_size": 800,
              "people": [...],
              ...
            }
          ]
        },
        ...
      ],
      "pipeline": "ai-prospecting"
    }
    ```
  </Tab>
</Tabs>

***

## 失敗した配信のリトライ

特定のトリガーが失敗した場合（例：ウェブフックが一時的にダウン）、スキャン全体を再実行せずにリトライできます：

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.pubrio.com/monitors/process/retry \
    -H "Content-Type: application/json" \
    -H "pubrio-api-key: YOUR_API_KEY" \
    -d '{
      "monitor_id": "YOUR_MONITOR_ID",
      "monitor_log_id": "THE_FAILED_LOG_ID",
      "profile_id": 1
    }'
  ```
</CodeGroup>

[統計ログ](/jp/api-reference/endpoint/monitors/statistics_logs)をクエリし、`"status": "failed"` のエントリをフィルタリングして `monitor_log_id` を見つけてください。

***

## 次のステップ

<CardGroup cols={2}>
  <Card title="ベストプラクティス" icon="star" href="/jp/developer-guides/best-practices">
    フリクエンシー、クレジット、リトライ、スケーリング。
  </Card>

  <Card title="ウェブフック設定" icon="plug" href="/jp/developer-guides/setting-up-webhooks">
    詳細なウェブフック設定とシグネチャ検証。
  </Card>
</CardGroup>
