Trying to drop a single participant from an active conference using the JS SDK. The docs say sending a participants array with the specific participantId and action: disconnect should work. It’s not. The call ends for everyone.
Here’s the payload I’m constructing. I’m grabbing the participantId from the initial GET /conversations/conversations/{id} response, so the ID is definitely valid. The conversationId is also correct.
{
"participants": [
{
"participantId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"action": "disconnect"
}
]
}
I’m hitting PATCH /api/v2/conversations/conversations/{conversationId}. The response is 204 No Content. No error. But when I check the conversation state immediately after, the state is disconnected and all participants show state: disconnected. I expected only the target participant to drop.
I’ve tried sending the full list of participants with action: update for others and action: disconnect for the target, as some old forum posts suggested, but that fails with a 400 Bad Request complaining about conflicting actions. The SDK method conversationsApi.updateConversation seems to wrap the PATCH call, so I’m using that.
Is the participants array supposed to be exhaustive? If I only send the one I want to drop, does the API assume the rest should be removed? That seems broken. I’ve checked the Swagger spec and it says “participants to update”. Plural implies a subset, but the behavior suggests a full state sync.
Running this from a Node.js backend, so no browser CORS issues. Token is fresh. Any ideas if I’m missing a flag or if the API is just strict about requiring the full participant list with explicit update actions for those staying?
The issue isn’t the participant ID, it’s the HTTP method and how the API interprets the payload. You’re likely hitting a full update endpoint by mistake, or the SDK is sending a PUT which replaces the entire conversation state. To remove just one person, you need to use PATCH specifically targeting the participants sub-resource, not the root conversation object.
Using the PureCloudPlatformClientV2 SDK in TypeScript, the correct approach is to call patchConversationParticipants. This method sends a partial update. If you send the whole array, it might still behave weirdly depending on the version, but usually, it’s safer to target the specific participant index or ID if the SDK supports it. However, the most reliable way via the raw API is a PATCH to /api/v2/conversations/{id}/participants.
Here’s how I structure it in my custom desktop app using the SDK helper:
import { ConversationsApi } from '@genesyscloud/purecloud-platform-client-v2';
// Assuming you have the api instance initialized
const conversationsApi = new ConversationsApi();
const body = {
participants: [
{
id: targetParticipantId, // The specific ID you want to drop
action: 'disconnect'
}
]
};
try {
await conversationsApi.patchConversationParticipants(conversationId, body);
console.log('Participant disconnected successfully');
} catch (error) {
console.error('Failed to disconnect participant', error);
}
The key here is ensuring you aren’t accidentally calling patchConversation on the root resource. That endpoint expects a full conversation object update and can trigger a reset of the whole session if the structure isn’t perfect. The participants sub-resource is designed for this exact granular control. Also, double-check your OAuth scope. You need conversations:write. If you’re missing that, you’ll get a 403, but if you’re seeing everyone disconnect, it’s almost certainly the wrong endpoint being hit. Check your network tab to see if the URL ends in /participants or just /conversations/{id}.