Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Home
/
Chat
/
JavaScript
/
User
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

Mute and unmute a user

Operators of an open or group channel can restrict select users from sending messages to the channel using the mute feature. A muted user remains in the channel and is allowed to view the messages but they can't send any messages until they're unmuted by the operators. Operators can mute and unmute users in channels using the following code.

// Mute a user.
await channel.muteUser(USER, SECONDS, DESCRIPTION);

// Unmute a user.
await channel.unmuteUser(USER);

Note: You can also use muteUserWithUserId() and unmuteUserWithUserId() as they have the same functionalities. See our API reference for more information.