From Bright Pattern Documentation

Revision as of 20:10, 2 April 2026 by Laura.donovan (talk | contribs) (Updated via BpClonePage extension. Source page: draft:AgentDesktop-client-side-javascript-api-specification/removeFromChatConference)

< Previous | Next >
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

removeFromChatConference

Remove another agent from the chat. If interactionId isn't specified, it will work with active interaction.

Request

Syntax

removeFromChatConference(partyId: string, interactionId?: string): Promise<OperationResult<null>>

Parameters

Parameter Parameter Values Data Type Optional/Required Description
partyId String Required ID of the chat party you intend to remove from the chat. This ID is not the same ID used to add users with method "inviteToChatConference". The correct ID can be obtained from interaction property chatParties, which you should get with subscription to events related to interactions (such as ON_INTERACTION_STATE_CHANGE).
interactionId String Optional ID of the chat interaction from which you want to remove a party. If not specified, the active interaction will be used.

Example Request

    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)

    }

Return Value

null

< Previous | Next >