Trying to drop a specific participant from an active conference using the @genesyscloud/conversations-client SDK. The docs show patchConversationsConversation but I’m struggling with the exact JSON body to remove just one leg without ending the whole call.
Here’s what I’ve got so far:
const response = await conversationsApi.patchConversationsConversation(conversationId, {
participants: [
{
id: participantToRemoveId,
state: 'closed'
}
]
});
This returns a 400 Bad Request with "errorCode":"invalid.request". The error message isn’t helpful. I know I can’t just send the participant I want to remove; I have to send the full list of participants with their current states, plus the one I want to close. But fetching the full list first feels like a race condition waiting to happen if someone else joins or leaves in the meantime.
Is there a better way to do this? Or do I really need to GET the conversation details, map the participants, update the target one to ‘closed’, and then PATCH the whole thing back? Seems clunky for such a common action.