Channel object
Channel is an object that refers to a single chat room.
Properties
The Channel object has the following properties:
1public class Channel : UniqueChatEntity {
2 public string Id { get; protected set; }
3 public string Name { get; }
4 public string Description { get; }
5 public Dictionary<string, object> CustomData { get; }
6 public string Updated { get; }
7 public string Status { get; }
8 public string Type { get; }
9}
| Parameter | Description |
|---|---|
IdType: string | Unique identifier for the channel. Verify the channel ID with our validator. |
NameType: string | Display name or title of the channel. |
DescriptionType: string | Brief description or summary of the channel's purpose or content. |
CustomDataType: Dictionary<string, object> | Custom data associated with the channel in the form of a JSON. Values must be scalar only; arrays or objects are not supported. App Context filtering language doesn’t support filtering by custom properties. |
UpdatedType: string | Timestamp indicating when the channel was last updated or modified. |
StatusType: string | Current status of the channel, such as online, offline, or archived. |
TypeType: string | One of the available channel types:
|
API limits
To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.
Events
The Channel object has the following events:
1// Event triggered when a message is received on a channel
2public event Action<Message> OnMessageReceived;
3// Event triggered when a channel is updated
4public event Action<Channel> OnChannelUpdate;
5// Event triggered when a presence state changes on a channel
6public event Action<List<string>> OnPresenceUpdate;
7// Event triggered when typing is detected on a channel
8public event Action<List<string>> OnUsersTyping;
9// Event triggered when a read receipt is received on a channel
10public event Action<Dictionary<string, List<string>>> OnReadReceiptEvent;
11// Event triggered when a report is received on a channel
12public event Action<ChatEvent> OnReportEvent;
13// Event triggered when a custom event is received on a channel
14public event Action<ChatEvent> OnCustomEvent;
Example
An event that is triggered when a new message is received on a channel.
1
Methods
You can call the following methods on the Channel object.
Click on each method for more details.
CreateMessageDraft()Connect()Delete()Disconnect()EmitUserMention()ForwardMessage()GetMessageHistory()GetMessage()GetMemberships()GetPinnedMessage()GetUserRestrictions()GetUsersRestrictions()Invite()InviteMultiple()IsUserPresent()Join()Leave()PinMessage()SendText()SetListeningForCustomEvents()SetListeningForTyping()SetListeningForPresence()SetListeningForReadReceiptsEvents()SetListeningForReportEvents()SetRestrictions()StartTyping()StopTyping()Update()UnpinMessage()WhoIsPresent()
Use case
For example, you can use the Channel object methods to:
- Let users send messages.
- Create and manage a 1:1, group, or public channel (chat).
- Invite others to join the channel.
- Configure a typing indicator to track when someone in the room is writing a message.