提供: Bright Pattern Documentation
• 日本語

Revision as of 02:46, 23 September 2026 by BpTranslationReview (talk | contribs) (Reviewed via BpTranslationReview)

< 前へ | 次へ >
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
移動先: 案内、 検索
• English

onInteractionStateChange

このハンドラーは、アクティブなエージェントのインタラクションのいずれかの状態が変化した際に呼び出されます。

リクエスト

構文

on('ON_INTERACTION_STATE_CHANGE', handler: OnInteractionStateChangeHandler): void


type OnInteractionStateChangeHandler = (interaction: InteractionData) => void


type InteractionData = {

   interactionId: string
   state: InteractionState
   type: InteractionType
   subject: string
   associatedObjects: InteractionAssociatedObjectsData
   callParties: CallParty[]
   callMuted: boolean
   callRecording: boolean
   attachedData: AttachedData
   phoneNumber?: string
   email?: string
   callDirection?: CallDirection
   startTime?: number
   endTime?: number
   duration?: number
   description?: string
   disposition?: string
   globalInteractionId?: string
   service?: string
   playbackUrl?: string
   recordingUrl?: string
   DNIS?: string
   ANI?: string
   origination?: InteractionOrigination

}

type InteractionType = "voice" | "chat" | "email"

type InteractionState =

   "unknown" |
   "queued" |
   "ivr" |
   "wrap_up" |
   "wrap_up_hold" |
   "delivered" |
   "delivery_pending" |
   "hold" |
   "completed"

type InteractionOrigination =

   "dialpad" |
   "dialpad-search" |
   "directory" |
   "recent" |
   "favorites" |
   "workitem" |
   "interaction" |
   "contact-profile" |
   "help" |
   "conference" |
   "auto" |
   "integration-api"

type CallDirection = "inbound" | "outbound"

type CallParty = {

 id: string
 name: string
 phone: string
 userId?: string

}


パラメータ

パラメータ パラメータ値 データ型 オプション/必須 説明
interaction
type 文字列 必須 インタラクションの種類を示します。認識されるタイプは以下の通りです:
  • "voice"
  • "chat"
  • "email"
agentId 文字列 必須 エージェントのID
interactionId 文字列 必須 インタラクションのID
globalInteractionId 文字列 オプション インタラクションのグローバルインタラクションID(GIID)
service 文字列 オプション そのインタラクションに関連するサービスの名前
callParties 文字列 必須 通話参加者のリストを提供します。なお、これはtypeが「voice」であるインタラクションに適用されます。 詳細:
  • id
    • 一意の参加者ID
  • name
    • 参加者の表示名
  • phone
    • 使用される電話番号
  • userId?
    • (オプション)一意のユーザーIDです。つまり、getTeamMembersメソッドのTeamMemberリストエントリからのIDとなります。相手が内部ユーザーでない場合、userIdは未定義となります
callMuted ブール値 必須 true に設定するとコールはミュートされ、false に設定するとミュートされません。なお、コール以外のインタラクションでは常に false となります。
callRecording ブール値 必須 true に設定すると、通話録音機能が有効になります。false に設定すると、通話録音機能は無効になります。通話以外のインタラクションについては、常に false に設定される点にご注意ください。
disposition 文字列 オプション 完了したインタラクションのdispositionカテゴリーの名前
recordingUrl 文字列 オプション 通話録音のURLです。なお、これはtypeが「voice」であるインタラクションに適用される点にご注意ください。
callDirection 文字列 オプション コールのタイプです。認識される方向は以下の通りです:
  • "inbound"
  • "outbound"

なお、これはtypeが「voice」であるインタラクションに適用されます。

DNIS 文字列 オプション ダイヤル番号識別サービス(DNIS)です。なお、これはtypeが「voice」であるインタラクションに適用されます。
transferANI ? オプション 転送時の自動番号識別(ANI)です。なお、これはtypeが「voice」であるインタラクションに適用されます。
phoneNumber 文字列 オプション 着信先の電話番号です。なお、これはtypeが「voice」であるインタラクションに適用されます。
startTime 数値 オプション インタラクションの開始日時
endTime 数値 オプション インタラクションの終了日時
duration 数値 オプション インタラクションの継続時間(秒単位)
origination 文字列 オプション インタラクションがどのように開始されたかを示します。あらかじめ定義された値のリストがあります。

リクエスト例

const interactionsList: InteractionData[] = [];

function interactionStateChangeCallback(data: InteractionData) {

const index = interactionsList.findIndex(item => item.interactionId === data.interactionId);

if (index === -1) {

interactionsList.push(data);

} else {

interactionsList[index] = data;

}

}

adApi.on("ON_INTERACTION_STATE_CHANGE", interactionStateChangeCallback);

戻り値

(なし)

< 前へ | 次へ >