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

# カスタム ワークフロー アクションを定義する（ベータ版）

> 最新バージョンの開発者プラットフォーム（ベータ版）でカスタム ワークフロー アクションを定義する方法をご確認ください。

<style>
  {`
    .table-key, .table-key div, .table-key p {
        margin: 0;
        font-size: 14px;
      }
    `}
</style>

新しい開発者プラットフォームでアプリの[カスタム ワークフロー アクション](/api-reference/automation-actions-v4-v4/guide) を定義するには、プロジェクトに`*-hsmeta.json`設定ファイルを格納した`workflow-actions`ディレクトリーを含めます。

## プロジェクトのディレクトリー構造

```shell theme={null}
├──src
│   ├── app/
│   │   └── app-hsmeta.json
│   │   └── ...
│   │   └── workflow-actions/
│   │     └── custom-action-hsmeta.json
└──
```

## カスタム ワークフロー アクションの定義

`*-hsmeta.json`ファイルで使用できる設定オプションを以下に示します。

```json theme={null}
{
  "uid": "simple_notification_action",
  "type": "workflow-action",
  "config": {
    "actionUrl": "https://example.com",
    "isPublished": false,
    "supportedClients": [
      {
        "client": "WORKFLOWS"
      }
    ],
    "inputFields": [
      {
        "typeDefinition": {
          "name": "message",
          "type": "string",
          "fieldType": "textarea"
        },
        "supportedValueTypes": ["STATIC_VALUE"],
        "isRequired": true
      },
      {
        "typeDefinition": {
          "name": "priority",
          "type": "enumeration",
          "fieldType": "select",
          "options": [
            {
              "value": "high",
              "label": "High Priority"
            },
            {
              "value": "normal",
              "label": "Normal Priority"
            },
            {
              "value": "low",
              "label": "Low Priority"
            }
          ]
        },
        "supportedValueTypes": ["STATIC_VALUE"],
        "isRequired": true
      }
    ],
    "labels": {
      "en": {
        "actionName": "My Custom Action (via Projects V2)",
        "actionDescription": "Sends a notification with custom message and priority level",
        "actionCardContent": "Send {{priority}} priority notification",
        "inputFieldLabels": {
          "message": "Notification Message",
          "priority": "Priority Level"
        },
        "inputFieldDescriptions": {
          "message": "Enter the message to be sent in the notification",
          "priority": "Select the priority level for this notification"
        }
      }
    },
    "objectTypes": ["CONTACT"]
  }
}
```

<p className="table-key">
  <span style={{ color: 'red' }}>\*</span>でマークされたフィールドは必須です。
</p>

| フィールド                                                                 | 型         | 説明                                                                                                                           |
| --------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `uid`<span style={{color:"red"}}>\*</span>                            | 文字列       | ワークフローアクションの内部固有ID。                                                                                                          |
| `type`<span style={{color:"red"}}>\*</span>                           | 文字列       | コンポーネントのタイプ。この場合は`workflow-action`にする必要があります。                                                                                |
| `actionUrl`<span style={{color:"red"}}>\*</span>                      | 文字列       | ワークフロー実行リクエストを配信するためのAPIのWebhook URL。                                                                                        |
| `isPublished`                                                         | ブール値      | アプリをインストールしたアカウントに定義が表示されるかどうかを決定します。既定では、`false`に設定されています。                                                                  |
| `supportedClients`<span style={{color:"red"}}>\*</span>               | オブジェクトの配列 | カスタム ワークフロー アクションがサポートするクライアントを指定します。配列内の各オブジェクトには、クライアントのタイプを示す文字列値（`WORKFLOWS`など）を設定したクライアントキーを指定する必要があります。                |
| `inputFields`                                                         | 配列        | ユーザーが入力フィールドに入力した値。                                                                                                          |
| `typeDefinition.name`                                                 | 文字列       | 入力フィールドの名前またはキー。                                                                                                             |
| `typeDefinition.type`                                                 | 文字列       | 入力フィールドに入力される値のタイプ。                                                                                                          |
| `typeDefinition.fieldType`                                            | 文字列       | ワークフローを作成するユーザーに対して表示されるフィールドのタイプ。                                                                                           |
| `typeDefinition.options`                                              | 配列        | 列挙型の場合、このフィールドでオプションのリストを指定します。各オプションには、ユーザーが入力した情報に基づく`value`と、ワークフローツール内でオプションを識別する`label`が必要です。                           |
| `inputFieldDependencies`                                              | 配列        | `dependencyType`に基づいて2つ以上の入力間の関係を定義するルールのリスト。[こちらの例](/api-reference/automation-actions-v4-v4/guide#example-%233)で詳細をご確認ください。 |
| `labels.<locale>`<span style={{color:"red"}}>\*</span>                | 文字列       | ロケール定義にマッピングされるロケールキー。少なくとも、英語のラベル（`en`）とその定義を定義する必要があります。                                                                   |
| `labels.<locale>.inputFieldDescriptions`                              | オブジェクト    | アクションに関する入力内容の詳細を定義するオブジェクト。上記の例では、このオブジェクトに`message`フィールドと`priority`フィールドが含まれています。                                          |
| `labels.<locale>.inputFieldOptionLabels`                              | オブジェクト    | 入力フィールドにオプションがある場合に必要となるオブジェクト。オプションの値またはラベルをキーとして使用して、入力フィールドのオプションラベルのマップを提供します。                                           |
| `labels.<locale>.outputFieldLabels`                                   | オブジェクト    | `outputFields`の定義を、ワークフローツールに表示される、該当するラベルにマッピングするオブジェクト。                                                                    |
| `labels.<locale>.actionName`<span style={{color:"red"}}>\*</span>     | 文字列       | ワークフローエディターの［アクションを選択］\_\_パネルに表示するアクションの名前。                                                                                  |
| `labels.<locale>.appDisplayName`<span style={{color:"red"}}>\*</span> | 文字列       | アプリの全てのアクションが表示される、［アクションを選択］\_\_パネルのセクションの名前。複数のアクションで`appDisplayName`が定義されている場合、最初に見つかった名前が使用されます。                         |
| `labels.<locale>.actionCardContent`                                   | 文字列       | アクションのカードに表示する説明の要約。                                                                                                         |
| `labels.<locale>.executionRules`                                      | オブジェクト    | `executionRules`の定義を、ワークフローの履歴に実行結果として表示されるメッセージにマッピングするオブジェクト。                                                              |
| `objectTypes`                                                         | 配列        | このアクションで処理できるCRMオブジェクトタイプ。空白の場合、全てのオブジェクトタイプで当該アクションを使用できます。                                                                 |
| `outputFields`                                                        | 配列        | アクションによって出力する値。この値は、ワークフローの以降のアクションで使用できます。カスタムアクションの出力はゼロにすることも、1つまたは複数にすることもできます。                                          |
| `executionRules`                                                      | オブジェクト    | ワークフローを作成するユーザーに対し、貴社のサービスからのエラーを示すために指定できる定義のリスト。                                                                           |
