導入

nocallシステムからWebhookを通じて通話情報を受け取るための仕様です。通話進捗や完了などのイベント時に、登録済みURLへ HTTP POST を送信します。

Webhook登録方法

管理画面から Webhook URL を登録してください。

ペイロード

{
  "id": "1",
  "timestamp": "2025-03-28T15:45:05.240+09:00",
  "callStatus": "completed",
  "from": "+815012345678",
  "to": "+819098765432",
  "detailsUrl": "https://example.com/console/call-history/1",
  "endUser": {
    "id": "1",
    "phoneNumber": "+819012345678",
    "attributions": {
      "姓": "山田",
      "名": "太郎"
    }
  },
  "conversation": {
    "startTime": "2025-03-28T15:40:05.240+09:00",
    "endTime": "2025-03-28T15:45:05.240+09:00",
    "duration": 300,
    "message": [
      { "role": "system", "content": "system message" },
      { "role": "assistant", "content": "assistant message" },
      { "role": "user", "content": "user message" },
      {
        "role": "assistant_tool_call",
        "tool_calls": [
          {
            "id": "tool_call_123",
            "name": "tool name",
            "args": { "arg1": "value1" }
          }
        ]
      },
      {
        "role": "tool",
        "content": "tool result",
        "name": "tool name",
        "tool_call_id": "tool_call_123"
      }
    ],
    "goalStatus": "achieved",
    "goalResult": "成功しました。"
  },
  "agent": {
    "id": 1,
    "name": "agent1"
  }
}

各フィールドの説明

トップレベル

フィールド名 型 説明
id string 通話の一意識別子
timestamp string ISO 8601形式の日時(オフセット付き、例: +09:00。タイムゾーン名は含まれない)
callStatus string preparing(準備中), ringing(呼び出し中), completed(完了), no_answer(応答なし), failed(失敗)
from string 発信元電話番号(E.164形式)
to string 着信先電話番号(E.164形式)
detailsUrl string or null 通話詳細画面のURL(取得できない場合は null)
endUser object or null エンドユーザー情報(紐付かない場合は null)
conversation object or null 会話情報(存在する場合のみ。なければ null)
agent object 利用されたエージェント情報

endUser オブジェクト

フィールド名 型 説明
id string エンドユーザーID
phoneNumber string 電話番号(E.164形式)
attributions object 属性のマップ。キー=属性ラベル(例: 「姓」「名」)、値=文字列

conversation オブジェクト

フィールド名 型 説明
startTime string or null 通話開始時刻(ISO 8601形式、オフセット付き)
endTime string or null 通話終了時刻(ISO 8601形式、オフセット付き)
duration number or null 通話時間(秒)
message array or null 会話メッセージの配列
goalStatus string 目標達成状態
goalResult string or null 目標達成の結果テキスト

message 型(参考)

type BasicMessage = {
  role: "system" | "assistant" | "user";
  content: string;
};

type AssistantToolCallMessage = {
  role: "assistant_tool_call";
  tool_calls: {
    id: string;
    name: string;
    args: Record<string, any>;
  }[];
};

type ToolResultMessage = {
  role: "tool";
  content: string;
  name: string;
  tool_call_id: string;
};

type Message = BasicMessage | AssistantToolCallMessage | ToolResultMessage;

agent オブジェクト

フィールド名 型 説明
id number エージェントID
name string エージェント名