Stream Chat icon

Stream Chat

Server-side Stream Chat operations

Overview

The "Query Members" operation of the Channel resource in this node allows you to retrieve a list of members from a specific chat channel within the Stream Chat platform. This is useful for scenarios where you need to analyze, display, or manage the users participating in a particular channel.

Common use cases include:

  • Displaying the current members of a team or group chat.
  • Filtering members based on certain criteria (e.g., role, join date).
  • Exporting member lists for reporting or integration with other systems.
  • Moderation tasks that require member information.

For example, you might query members of a "team" type channel with ID "project-alpha" to get all users currently part of that project’s chat room, optionally filtering by membership status or sorting by join date.

Properties

Name Meaning
Channel Type The type of the channel. Common options are: "messaging" (1-on-1 chats), "team" (group channels), and "livestream" (broadcast channels).
Channel ID Unique identifier for the channel (e.g., "general", "random", "team-alpha"). Combined with the channel type to form the full channel identifier (CID).
Query Filter A JSON object specifying filter criteria using MongoDB-style syntax to narrow down which members to return. For example, filtering by roles or user IDs.
Query Sort A JSON object defining how to sort the returned members. Use 1 for ascending or -1 for descending order on any member field, e.g., { "created_at": -1 }.
Limit Maximum number of member results to return. Must be at least 1. Defaults to 50.

Output

The output is an array of JSON objects representing the queried members of the specified channel. Each object contains member details as provided by the Stream Chat API, such as user IDs, roles, timestamps, and any custom member metadata.

No binary data is output by this operation.

Example output snippet (simplified):

[
  {
    "user_id": "user123",
    "role": "member",
    "created_at": "2023-01-15T12:34:56Z",
    "updated_at": "2023-02-01T08:00:00Z"
  },
  {
    "user_id": "user456",
    "role": "moderator",
    "created_at": "2023-01-10T09:20:30Z",
    "updated_at": "2023-02-05T14:22:11Z"
  }
]

Dependencies

  • Requires a valid API key credential for the Stream Chat service configured in n8n.
  • The node uses the Stream Chat server-side client SDK to perform operations.
  • The API credentials must have permissions to query channel members.

Troubleshooting

  • Empty Results: If no members are returned, verify the Channel Type and Channel ID are correct and that the channel exists. Also check your Query Filter to ensure it matches existing members.
  • Invalid JSON in Filters/Sort: Ensure that the Query Filter and Query Sort inputs are valid JSON objects. Malformed JSON will cause errors.
  • Permission Errors: Make sure the API key used has sufficient rights to access channel member data.
  • Rate Limits: Excessive queries may hit API rate limits; consider adding delays or reducing the Limit.
  • Error Messages: Errors typically indicate unsupported operations or invalid parameters. Review the error message for specifics and confirm all required fields are set.

Links and References

Discussion