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

# si_send_message

アクティブな SI セッション内でメッセージを送信します。ホストはこのタスクを呼び出し、ユーザーメッセージやアクションレスポンスをブランドエージェントに中継します。

## リクエスト

| Field             | Type   | Required | Description                     |
| ----------------- | ------ | -------- | ------------------------------- |
| `session_id`      | string | Yes      | `si_initiate_session` のセッション ID |
| `message`         | string | No       | ユーザーのテキストメッセージ                  |
| `action_response` | object | No       | UI アクション（ボタンクリック、フォーム送信）へのレスポンス |

`message` または `action_response` のいずれかは必須です。

### Action Response オブジェクト

ユーザーが UI 要素とやり取りした場合:

| Field        | Type   | Required | Description      |
| ------------ | ------ | -------- | ---------------- |
| `action`     | string | Yes      | UI 要素由来のアクション識別子 |
| `element_id` | string | No       | 特定の UI 要素の ID    |
| `payload`    | object | No       | やり取りから得た追加データ    |

## レスポンス

| Field            | Type   | Description                                    |
| ---------------- | ------ | ---------------------------------------------- |
| `session_id`     | string | アクティブなセッションの確認                                 |
| `response`       | object | ブランドエージェントからのレスポンス                             |
| `session_status` | string | 現在のセッション状態                                     |
| `handoff`        | object | `session_status` が "pending\_handoff" のときに含まれる |

### Sponsored Context Receipts

以前の `si_initiate_session` または `si_send_message` レスポンスが `sponsored_context` を含んでいた場合、ホストは、そのコンテキストを提示、比較、またはその他の方法で使用する前に、宣言された `context_use` と `disclosure_obligation` を尊重できるかどうかを決定します。後続の `si_send_message` リクエストで、ホストは通常の `message` または `action_response` とともに `sponsored_context_receipt` を含めて、その決定をブランド/セラーに見えるようにしてもかまいません（MAY）。

受け入れられたレシートでは、`accepted_context_use` が宣言の `context_use` に一致しなければならず、開示が必要だった場合は `disclosure_commitment.status` が `accepted` でなければなりません。拒否されたレシートでは、`accepted_context_use` と `disclosure_commitment` を省略します。ホストがコンテキストを受け入れなかった、または使わなかった理由を説明したい場合は `rejection_reason` を使います。

`si_send_message` レスポンスが新しい `sponsored_context` を含む場合、ホストが受信サーフェスでそのレスポンスコンテキストを使う前に、同じ受け入れまたは拒否の決定が適用されます。ホストは次のターンでレシートを含めるか、次の SI 呼び出しがない場合は自身の監査記録に保持できます。

### Session Status 値

| Status            | Description             |
| ----------------- | ----------------------- |
| `active`          | セッションが通常継続中             |
| `pending_handoff` | ブランドエージェントがハンドオフ準備完了を示す |
| `complete`        | 会話が完了                   |

### Handoff オブジェクト

`session_status` が `pending_handoff` の場合:

| Field                  | Type   | Description                  |
| ---------------------- | ------ | ---------------------------- |
| `type`                 | string | "transaction" または "complete" |
| `intent`               | object | 取引の場合: ユーザーが購入したい内容          |
| `context_for_checkout` | object | ACP ハンドオフ用のサマリー              |

## 例

### シンプルなメッセージ交換

**Request:**

```json theme={null}
{
  "session_id": "sess_abc123",
  "message": "Do you have any earlier flights?"
}
```

**Response:**

```json theme={null}
{
  "session_id": "sess_abc123",
  "response": {
    "message": "Yes! There's DL628 departing at 5:30 AM. It's a bit earlier but also qualifies for the Premium Economy upgrade.",
    "ui_elements": [
      {
        "type": "carousel",
        "data": {
          "items": [
            {
              "title": "DL628 - 5:30 AM",
              "subtitle": "Arrives 8:57 AM",
              "price": "$199",
              "badge": "Free Upgrade"
            },
            {
              "title": "DL632 - 6:15 AM",
              "subtitle": "Arrives 9:42 AM",
              "price": "$199",
              "badge": "Free Upgrade"
            }
          ]
        }
      }
    ]
  },
  "session_status": "active"
}
```

### アクションレスポンス（ボタンクリック）

**Request:**

```json theme={null}
{
  "session_id": "sess_abc123",
  "action_response": {
    "action": "select_flight",
    "payload": {
      "flight_number": "DL628",
      "departure_time": "05:30"
    }
  }
}
```

**Response:**

```json theme={null}
{
  "session_id": "sess_abc123",
  "response": {
    "message": "Great choice! DL628 is confirmed with your Premium Economy upgrade. Ready to book?",
    "ui_elements": [
      {
        "type": "product_card",
        "data": {
          "title": "DL628 to Boston",
          "subtitle": "Tue Jan 27, 5:30 AM → 8:57 AM",
          "price": "$199",
          "badge": "Premium Economy",
          "cta": { "label": "Book Now", "action": "checkout" }
        }
      }
    ]
  },
  "session_status": "active"
}
```

### トランザクションハンドオフ

ユーザーが購入準備完了の場合:

**Request:**

```json theme={null}
{
  "session_id": "sess_abc123",
  "action_response": {
    "action": "checkout"
  }
}
```

**Response:**

```json theme={null}
{
  "session_id": "sess_abc123",
  "response": {
    "message": "Perfect! I'll hand you back to complete the booking."
  },
  "session_status": "pending_handoff",
  "handoff": {
    "type": "transaction",
    "intent": {
      "action": "purchase",
      "product": {
        "type": "flight",
        "flight_number": "DL628",
        "departure": "2026-01-27T05:30:00-05:00",
        "arrival": "2026-01-27T08:57:00-05:00",
        "origin": "JFK",
        "destination": "BOS",
        "class": "premium_economy"
      },
      "price": {
        "amount": 199,
        "currency": "USD"
      }
    },
    "context_for_checkout": {
      "conversation_summary": "Jane selected DL628 JFK→BOS on Jan 27 with free Premium Economy upgrade via campaign offer",
      "applied_offers": ["delta_chatgpt_3313"]
    }
  }
}
```

## ハンドオフの扱い

`session_status: "pending_handoff"` を受け取ったら:

1. **`type: "transaction"` の場合** - 提供された intent とコンテキストで ACP チェックアウトを開始します
2. **`type: "complete"` の場合** - 会話完了として通常チャットに戻る

ハンドオフ処理後、ホストは `si_terminate_session` を呼び出して適切にセッションを閉じるべきです。

## キーポイント

1. **message または action\_response** - 各リクエストには少なくともどちらかが必要です。ユーザーはメッセージ入力か UI 操作でやり取りします。

2. **セッションステータスがフローを決める** - 各レスポンスで `session_status` を確認し、会話継続かハンドオフ必要かを判断します。

3. **ハンドオフでコンテキストを保持** - `context_for_checkout` オブジェクトが ACP にシームレスな購入体験に必要な情報を提供します。

4. **UI 要素は任意** - カードやカルーセルをいつ含めるかは、ブランドエージェントが会話に応じて判断します。
