Stream Chat icon

Stream Chat

Server-side Stream Chat operations

Overview

The "Demote Moderators" operation in the Channel resource allows you to remove moderator privileges from specified users within a particular chat channel. This is useful for managing user roles dynamically, especially when moderators no longer need elevated permissions or when adjusting team structures.

Practical scenarios include:

  • Revoking moderator rights after a project phase ends.
  • Adjusting moderation roles based on user activity or behavior.
  • Automating role changes in response to external triggers or workflows.

Example: You have a group chat channel "team-alpha" of type "team". You want to demote users "john_doe" and "jane_smith" from their moderator roles. Using this operation, you specify the channel type as "team", channel ID as "team-alpha", and members as "john_doe,jane_smith" to remove their moderator status.

Properties

Name Meaning
Channel Type The type of the channel. Common options are: "messaging" (1-on-1 chats), "team" (group channels), "livestream" (broadcast channels).
Channel ID Unique identifier for the channel (e.g., "general", "random", "team-alpha"). Combined with type to form CID.
Members Comma-separated list of user IDs to be demoted from moderator status (e.g., "john_doe,jane_smith,admin123"). No spaces around commas.

Output

The node outputs a JSON object representing the result of the demotion operation. This typically includes details about the updated channel state or confirmation of the action performed by the Stream Chat API.

If multiple input items are processed, the output is an array of such JSON objects corresponding to each input.

No binary data is produced by this operation.

Dependencies

  • Requires an API key credential with appropriate permissions to manage channels and user roles in the Stream Chat service.
  • The node uses the Stream Chat server-side client SDK to perform operations.
  • Proper configuration of the API credentials in n8n is necessary for authentication.

Troubleshooting

  • Common Issues:

    • Invalid or missing Channel ID or Channel Type can cause failures.
    • Specifying user IDs that are not members or moderators of the channel may result in errors or no effect.
    • Insufficient API permissions will lead to authorization errors.
  • Error Messages:

    • "Unsupported operation: channel.demoteModerators": Indicates the operation name or resource was incorrect or not implemented.
    • API errors related to invalid channel or user IDs usually include descriptive messages from the Stream Chat API.
  • Resolutions:

    • Verify that the Channel Type and Channel ID are correct and exist in your Stream Chat app.
    • Ensure the user IDs listed in Members are valid and currently moderators.
    • Confirm that the API key credential has the required permissions to modify channel moderators.
    • Enable "Continue On Fail" in the node settings to handle partial failures gracefully during bulk operations.

Links and References

Discussion