Getting a weird error when trying to mute the agent’s microphone programmatically using the @genesyscloud/controlling-client SDK.
Error: Operation 'mute' is not allowed for conversation type 'voice' with current state 'connected'
Here’s the snippet I’m working with. We’re building a custom agent assist widget that needs to programmatically mute the agent if certain compliance keywords are detected in the transcript stream.
const { useSession, useConversation } = require('@genesyscloud/controlling-client');
async function toggleMic(session, conversationId) {
const conversation = await session.getConversation(conversationId);
// Conversation object looks fine, state is 'connected'
console.log('Current State:', conversation.state);
try {
await session.mute(conversationId, { muted: true });
} catch (err) {
console.error('Mute failed:', err);
}
}
The session object is authenticated via OAuth client credentials, and the user scope includes conversation:write. I can see the call is active in the Genesys Cloud UI, and the getConversation call returns the correct participant list. But hitting session.mute throws that specific error about the operation not being allowed.
I’ve checked the REST API docs for /api/v2/interactions/conversations/voice/{conversationId}/participants/{participantId}, and the PATCH payload looks straightforward:
{
"muted": true
}
But the SDK wrapper seems to be doing something different under the hood, or maybe I’m missing a required flag in the session config. We’re on the latest version of the JS SDK (v2.4.1).
Is there a specific capability flag I need to enable on the user profile? Or is this a known limitation of the controlling-client SDK for voice interactions? I tried switching to the standard @genesyscloud/purecloud-api-client and calling the REST endpoint directly, but that gives me a 403 Forbidden, which feels like a scope issue even though I’ve double-checked the token.
Any ideas on what I’m missing here? The documentation for the controlling-client is pretty sparse on error codes.