Stream Chat icon

Stream Chat

Server-side Stream Chat operations

Overview

The "Mute User" operation in the Moderation resource allows you to mute a specific user within your Stream Chat application. Muting a user prevents them from sending messages or participating actively for a specified duration. This is useful in scenarios where a user is disruptive or violating community guidelines, and you want to temporarily restrict their communication privileges without banning them entirely.

Practical examples include:

  • Temporarily muting a user who is spamming or using inappropriate language.
  • Applying a timeout to a user during live chat events to maintain order.
  • Automatically muting users flagged by moderation tools for review.

Properties

Name Meaning
Target User ID The unique identifier of the user to be muted.
Reason A text description explaining why the user is being muted.
Timeout (Minutes) Duration of the mute in minutes. Set to a high number (e.g., 525600) for permanent mute.

Output

The node outputs a JSON object representing the result of the mute operation. This typically includes details about the muted user and the applied mute settings such as reason and timeout duration.

Example output structure (simplified):

{
  "id": "targetUserId",
  "mute": {
    "reason": "Provided reason",
    "timeout": 60
  },
  // Additional metadata fields returned by the API
}

No binary data is produced by this operation.

Dependencies

  • Requires an API key credential with permissions to perform server-side moderation actions on the Stream Chat service.
  • The node uses the Stream Chat server SDK client internally to execute the mute operation.
  • Proper configuration of the API credentials in n8n is necessary for authentication.

Troubleshooting

  • Common issues:

    • Invalid or missing Target User ID will cause the operation to fail.
    • Insufficient permissions in the API key credential may result in authorization errors.
    • Providing a timeout value less than 1 minute will be rejected due to validation rules.
  • Error messages:

    • "Unsupported operation: moderation.muteUser" indicates the operation name or resource was not recognized; verify correct selection.
    • Errors related to invalid user IDs or network issues will be reported with descriptive messages.
  • Resolution tips:

    • Ensure the Target User ID corresponds to an existing user in your Stream Chat app.
    • Verify that the API key credential has moderation rights.
    • Use valid numeric values for the timeout property respecting minimum constraints.

Links and References

Discussion