提供: Bright Pattern Documentation
• English
removeFromChatConference
チャットから別のエージェントを削除します。interactionIdが指定されていない場合は、アクティブなインタラクションに対して処理が行われます。
リクエスト
構文
| removeFromChatConference(partyId: string, interactionId?: string): Promise<OperationResult<null>> |
パラメータ
| パラメータ | パラメータ値 | データ型 | オプション/必須 | 説明 |
| partyId | 文字列 | 必須 | チャットから削除しようとしているチャット参加者のIDです。このIDは、メソッド「inviteToChatConference」を使用してユーザーを追加する際に使用されるIDとは異なります。正しいIDは、インタラクションのプロパティ「chatParties」から取得できます。このプロパティは、インタラクションに関連するイベント(ON_INTERACTION_STATE_CHANGE など)をサブスクライブすることで取得できます。 | |
| interactionId | 文字列 | オプション | 参加者を削除したいチャットインタラクションのIDです。指定されていない場合は、アクティブなインタラクションが使用されます。 |
リクエスト例
const interactionsMap = {};
let activeInteractionId = null;
adApi.on("ON_NEW_INTERACTION", interaction => {
interactionsMap[interaction.id] = interaction
})
adApi.on("ON_INTERACTION_STATE_CHANGE", interaction => {
interactionsMap[interaction.id] = interaction
})
adApi.on("ON_INTERACTION_REMOVED", interaction => {
delete interactionsMap[interaction.id]
})
adApi.on('ON_ACTIVE_INTERACTION_SWITCHED', interactionId => {
activeInteractionId = interactionId
})
function removeLastChatParty() {
const activeChatParties = interactionsMap[activeInteractionId].chatParties
const lastChatParty = activeChatParties[activeChatParties.length - 1]
adApi.removeFromChatConference(lastChatParty.id, activeInteractionId)
}
戻り値
null