Stream Chat icon

Stream Chat

Server-side Stream Chat operations

Overview

The "Shadow Ban User" operation in the Moderation resource allows you to shadow ban a user on the Stream Chat platform. Shadow banning is a moderation technique where the banned user can still interact with the chat, but their messages and activities are hidden or invisible to other users. This helps prevent disruptive behavior without alerting the user that they have been banned.

This node operation is useful in scenarios where you want to quietly restrict a user's ability to affect the community without escalating conflicts or causing backlash. For example, if a user is spamming or posting inappropriate content, shadow banning them can reduce harm while avoiding direct confrontation.

Practical examples:

  • Quietly restricting a spammer so their messages do not reach others.
  • Temporarily limiting a user suspected of violating rules without notifying them.
  • Applying bans based on IP address or user agent to block problematic clients.

Properties

Name Meaning
Target User ID The unique identifier of the user to be shadow banned.
Reason The reason for applying the shadow ban (optional descriptive text).
Timeout (Minutes) Duration of the shadow ban in minutes. Use a high number (e.g., 525600) for permanent bans.
IP Address Optional IP address to ban along with the user.
User Agent Optional user agent string to ban along with the user.

Output

The output JSON contains the response from the Stream Chat API after attempting to shadow ban the user. It typically includes details about the ban such as the user ID, reason, timeout duration, and any flags related to IP or user agent bans.

No binary data is output by this operation.

Example output structure (simplified):

{
  "user_id": "targetUserId",
  "reason": "Reason for ban",
  "timeout": 60,
  "ip_ban": true,
  "user_agent": "some user agent string"
}

Dependencies

  • Requires an active connection to the Stream Chat service via an API key credential configured in n8n.
  • The API key must have permissions to perform moderation actions including shadow banning users.
  • No additional external dependencies beyond the Stream Chat API.

Troubleshooting

  • Common issues:

    • Invalid or missing Target User ID will cause the operation to fail.
    • Insufficient permissions on the API key may result in authorization errors.
    • Providing invalid IP address or user agent formats could cause errors.
    • Using a timeout value less than 1 minute will be rejected.
  • Error messages:

    • "Unsupported operation: moderation.shadowBan" indicates the operation name or resource was incorrect.
    • "Error in moderation.shadowBan operation" with details usually means parameters were invalid or the API call failed.
  • Resolutions:

    • Ensure all required fields are provided and correctly formatted.
    • Verify API credentials have moderation rights.
    • Use valid IP addresses and user agent strings if specified.
    • Set timeout to at least 1 minute or use a large number for permanent bans.

Links and References

Discussion