Stream Chat icon

Stream Chat

Server-side Stream Chat operations

Overview

The node performs server-side operations on Stream Chat channels. Specifically, the Truncate operation removes all messages from a specified channel, effectively clearing its message history. This can be useful in scenarios where you want to reset a channel's conversation without deleting the channel itself, such as:

  • Clearing chat history for privacy or compliance reasons.
  • Resetting a channel before starting a new discussion or event.
  • Removing clutter from inactive or test channels.

For example, you might truncate a "general" messaging channel after an event ends to prepare it for a new event.

Properties

Name Meaning
Channel Type The type of the channel. Common options: "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 the full channel ID (CID).
Truncate Options JSON object specifying options for truncation. Example options include "hard_delete": true to permanently delete messages and "skip_push": false to control push notifications.

Output

The output is a JSON object representing the result of the truncate operation returned by the Stream Chat API client. It typically contains confirmation details about the truncation action performed on the channel.

No binary data is output by this operation.

Dependencies

  • Requires an API key credential with permissions to manage Stream Chat channels.
  • The node uses the Stream Chat server-side client library 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 will cause the operation to fail.
    • Insufficient API permissions may result in authorization errors.
    • Malformed JSON in the "Truncate Options" property can cause parsing errors.
  • Error messages:

    • "Unsupported operation: channel.truncate": Indicates the operation is not recognized; ensure the correct resource and operation are selected.
    • API errors related to channel not found or permission denied: Verify the channel exists and the API key has appropriate rights.
    • JSON parse errors for truncate options: Validate the JSON syntax in the input field.

To resolve errors, double-check input parameters, ensure valid JSON formatting, and confirm API credentials have required permissions.

Links and References

Discussion