Actions60
- User Actions
- Channel Actions
- Accept Invite
- Add Members
- Add Moderators
- Archive
- Ban User
- Create
- Delete
- Delete File
- Delete Image
- Demote Moderators
- Disable Slow Mode
- Enable Slow Mode
- Get Config
- Hide
- Invite Members
- Mark Read
- Mark Unread
- Mute
- Mute Status
- Pin
- Query Channels
- Query Members
- Reject Invite
- Remove Members
- Send Action
- Send File
- Send Image
- Show
- Stop Watching
- Truncate
- Unarchive
- Unban User
- Unmute
- Unpin
- Update
- Watch
- Message Actions
- Moderation Actions
Overview
The "Ban User" operation under the Moderation resource allows you to globally ban a user from your Stream Chat application. This action restricts the banned user's ability to interact within the chat environment according to the ban parameters set. It is useful in scenarios where a user violates community guidelines or terms of service, and you want to prevent them from participating further.
Practical examples include:
- Banning a user who repeatedly posts inappropriate content.
- Temporarily banning a user for disruptive behavior with a timeout duration.
- Banning based on IP address or user agent to block multiple accounts from the same source.
Properties
| Name | Meaning |
|---|---|
| Target User ID | The unique identifier of the user to be banned globally. |
| Reason | A text description explaining why the user is being banned. |
| Timeout (Minutes) | Duration of the ban in minutes. Set 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 node outputs a JSON object representing the result of the ban operation. This typically includes details about the banned user and the ban parameters applied (reason, timeout, IP ban flag, user agent if provided). The output confirms that the ban was successfully applied.
No binary data is produced by this operation.
Example output JSON structure:
{
"id": "targetUserId",
"banned": true,
"ban_details": {
"reason": "Violation of rules",
"timeout": 60,
"ip_ban": true,
"user_agent": "Mozilla/5.0"
}
}
Dependencies
- Requires an API key credential with permissions to perform moderation actions on the Stream Chat server.
- The node uses the Stream Chat server-side client SDK to execute the ban.
- Proper configuration of the Stream Chat API credentials in n8n is necessary.
Troubleshooting
Common issues:
- Missing or invalid Target User ID will cause the operation to fail.
- Insufficient API permissions can lead to authorization errors.
- Providing an invalid IP address or user agent format may cause unexpected results.
- Setting a timeout value less than 1 minute will be rejected due to validation.
Error messages:
"Unsupported operation: moderation.banUser"indicates a misconfiguration or unsupported operation selection.- API errors related to authentication or permission denied should be resolved by verifying API keys and roles.
- Validation errors on input parameters require checking the property values for correctness.