Mute a list of channel users

When a user is muted, they cannot send messages in a channel.

Muting and Unmuting

Moderators can mute and unmute users. When a user is muted, they cannot send messages in a channel. However, muted users will still be allowed to observe messages in a channel. The status of being muted is indefinite but is only applied at the channel level.

Mute Users

When a user is muted, all messages sent by that user to that channel will be rejected. This method is useful for preventing certain users from sending inappropriate messages, but still allowing them to participate in the conversation in a read-only manner. The timeout property allows you to make the timeout temporary, or permanent until unset by passing in -1.

repository.muteMembers({
  userIds: ['user1'],
  period: 600,
}).catch(error => {
  ...
});

The above logic will mute user1 in the selected channel for 10 minutes (600 seconds). An optional completion block notifies you when the action is complete.

If you want to permanently mute a user, pass in -1 as the mutePeriod. The user will stay muted until you explicitly unmute that user.

To unmute a user, call unmuteUsers():

repository.unmuteMembers({
  userIds: ['user1'],
}).catch(error => {
  ...
});

Last updated