Trying to programmatically toggle the microphone mute state for an agent using the JavaScript SDK. The goal is to have a custom UI button in our internal tooling that mutes the agent without them having to click the native Genesys widget controls. We are using the @genesyscloud/conv-client-sdk package.
I have the conversation ID and the participant ID handy. I tried calling conversationsApi.updateParticipant(conversationId, participantId, body) with the mute field set to true. The request consistently returns a 400 Bad Request. The error payload says:
{
"message": "Invalid participant state update request.",
"code": "bad_request",
"status": 400
}
I’ve double-checked the participant ID. It matches the one returned in the POST /api/v2/conversations/voice response. I also tried passing the full participant object back to the endpoint, just the mute boolean, and even tried setting hold to false to ensure no conflicting states. Nothing works.
Here is the :
const body = {
mute: true,
hold: false
};
try {
await conversationsApi.updateParticipant(conversationId, participantId, body);
console.log('Muted successfully');
} catch (error) {
console.error(error);
}
Is the updateParticipant endpoint even allowed for voice conversations? The documentation is vague on which fields are writable during an active call. I see people using PATCH /api/v2/conversations/voice/{id}/participants/{id} directly in curl examples, but the SDK wrapper seems to be blocking it or sending extra headers that cause the rejection.
Also, I noticed the SDK logs show it’s sending a PUT request, not a PATCH. Is that the issue? The REST API docs specify PATCH for partial updates. If the SDK is forcing a PUT, maybe it’s rejecting the partial payload because other required fields are missing?
I’ve spent two hours on this. The agent can’t use the native UI because our custom app overlays it. We need this mute function to work from our side.