Channel object
Channel
is an object that refers to a single chat room.
Properties
The Channel
object has the following properties:
public class Channel : UniqueChatEntity {
public string Id { get; protected set; }
public string Name { get; }
public string Description { get; }
public string CustomDataJson { get; }
public string Updated { get; }
public string Status { get; }
public string Type { get; }
}
Parameter | Type | Description |
---|---|---|
Id | string | Unique identifier for the channel. Verify the channel ID with our validator. |
Name | string | Display name or title of the channel. |
Description | string | Brief description or summary of the channel's purpose or content. |
CustomDataJson | string | 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. |
Updated | string | Timestamp indicating when the channel was last updated or modified. |
Status | string | Current status of the channel, such as online , offline , or archived . |
Type | 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:
// Event triggered when a message is received on a channel
public event Action<Message> OnMessageReceived;
// Event triggered when a channel is updated
public event Action<Channel> OnChannelUpdate;
// Event triggered when a presence state changes on a channel
public event Action<List<string>> OnPresenceUpdate;
// Event triggered when typing is detected on a channel
public event Action<List<string>> OnUsersTyping;
Example
An event that is triggered when a new message is received on a channel.
channel.OnMessageReceived += (channel) =>
{
Console.WriteLine("New message received!");
};
Methods
You can call the following methods on the Channel
object.
Click on each method for more details.
AddListenerToChannelsUpdate()
Connect()
Delete()
Disconnect()
ForwardMessage()
GetMessageHistory()
TryGetMessage()
GetMemberships()
TryGetPinnedMessage()
GetUserRestriction()
GetUsersRestrictions()
GetUserSuggestions()
Invite()
InviteMultiple()
IsUserPresent()
Join()
Leave()
PinMessage()
SendText()
SetRestrictions()
StartTyping()
StopTyping()
OnChannelUpdate
OnPresenceUpdate
OnUsersTyping
OnMessageReceived
StartListeningForUpdates()
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.