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; }
}
ParameterTypeDescription
IdstringUnique identifier for the channel. Verify the channel ID with our validator.
NamestringDisplay name or title of the channel.
DescriptionstringBrief description or summary of the channel's purpose or content.
CustomDataJsonstringCustom 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.
UpdatedstringTimestamp indicating when the channel was last updated or modified.
StatusstringCurrent status of the channel, such as online, offline, or archived.
TypestringOne of the available channel types:
  • direct (1:1)
  • group (multiple people, restricted by invitation)
  • public (open chat for a large audience, anyone can join it)
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.

Use case

For example, you can use the Channel object methods to:

Last updated on