Use deeper channel-level settings to override one or more settings for an individual channel without affecting other channels of the same channel type.
•7 months ago
The Stream Chat API now supports deeper channel-level settings, adding flexibility and customization options that can be especially helpful for use cases like livestream chat. In most cases, Stream recommends defining channel settings and features at the higher channel type level, causing all channels of the same type to inherit the same settings. In certain situations, however, it may be more practical to configure custom settings for a single chat channel without affecting other channels. The new channel-level settings functionality makes this possible.
If you’re already familiar with how channels work in Stream Chat, this addition should feel fairly intuitive and a quick skim of the channel-level settings documentation should get you up and running. If you’re newer to Stream Chat or could use a refresher, read on below to learn more about how channels and channel types work, and when to use channel-level settings.
What is a Chat Channel?
Chat channels establish conversations between groups of users. Usually, one group of users will be assigned one channel, as in a group chat between five friends on a social messaging app similar to iMessage, or a larger group of people watching the same livestream event.
Almost all chat API requests are specific to a channel (e.g. add a message to channel “livestream:rockets”). In Stream Chat, channels are organized in groups called channel types.
Given the specific requirements for your use case, you will likely want to enable or disable certain chat features. For example, typing indicators can be great for one-on-one social messaging but quickly become a nuisance during live events with high concurrency and many users typing at once. In Stream Chat, channel types make it easy and efficient to assign these kinds of features and settings by use case.
All Stream Chat applications come with four pre-configured channel types tailored to popular use cases, plus the option to define and configure custom channel types as desired. (Each app can have up to 50 total channel types.) The four pre-configured channel types include appropriate features, settings, and permissions for the following app categories:
- Livestream: Sensible defaults to build livestream chat like YouTube or Twitch.
- Messaging: Configured for apps similar to WhatsApp or Facebook Messenger.
- Team: Start here to build your own version of Slack or something similar.
- Commerce: Good defaults for building something like Intercom or Drift.
Use Cases for Channel-Level Settings
Channel types work great when every channel in the type can be configured identically, but some situations call for customization of a single channel within a channel type. For example, a livestream platform may host many similar events with relatively consistent attendance and chat usage, all adequately accommodated by a single channel type around which the platform is already built. Then, if the platform schedules a much larger one-off event to be hosted by a celebrity or an organization with unique needs, it may be appropriate to customize settings for a single channel instead of building out a new channel type to accommodate that event. Channel-level settings can also be helpful if your app needs to provide many different combinations of settings for channels.
The following channel type settings can now be overridden at the channel level:
- typing_events: Controls whether typing indicators are shown.
- reactions: Controls whether users are allowed to add reactions to messages.
- replies: Enables message threads and replies.
- uploads: Allows image and file uploads within messages.
- url_enrichment: When enabled, messages containing URLs will be enriched automatically with image and text related to the message.
- max_message_length: The max message length.
- blocklist: A list of words you can define to moderate chat messages. More information can be found here.
- blocklist_behavior: set as block or flag to determine what happens to a message containing blocked words.
Create Your First Chat Channel
The Stream Chat API makes it easy to build any type of dedicated messaging app or add in-app chat to any existing application or platform. Instead of building a chat backend from scratch, all you have to do is paste and customize a few lines of code to connect to Stream Chat. Front-end integration is easy too, with free UI components included and complete chat SDKs for popular frameworks like React, React Native, Flutter, iOS (Swift), and Android (Java+Kotlin).