Create channels
Channel naming
Before creating channels, take the time to carefully plan your naming strategy. Stick to consistent naming conventions and structure your channels thoughtfully. This preparation helps you avoid increased complexity, performance bottlenecks, and scalability issues, ensuring your app remains manageable and efficient as it grows.
Create channels (Channel objects) of one of these types:
Requires App Context
To store data about channels, you must enable App Context for your app's keyset in the Admin Portal.
No support for channel groups
Chat SDKs don't support channel groups. We recommend using a Core SDK to manage channel groups.
Create direct channel
Direct channels enable private 1:1 conversations. Use cases include personal conversations and professional collaboration.
CreateDirectConversation() performs these actions:
- Creates a channel with the
directtype - Sets channel membership for the channel owner
- Invites the other user and creates a membership with a
"pending"status (generates aninviteevent)
If a conversation between the two users already exists, the method returns that existing channel.
Receive messages
Call Connect() to start receiving messages on the channel.
Method signature
This method takes the following parameters:
1chat.CreateDirectConversation(
2 User user,
3 string channelId = "",
4 ChatChannelData? channelData = null,
5 ChatMembershipData? membershipData = null)
6
7public class ChatChannelData
8{
9 public string Name { get; set; } = string.Empty;
10 public string Description { get; set; } = string.Empty;
11 public Dictionary<string, object> CustomData { get; set; } = new ();
12 public string Updated { get; internal set; } = string.Empty;
13 public string Status { get; set; } = string.Empty;
14 public string Type { get; set; } = string.Empty;
15}
Input
| Parameter | Description |
|---|---|
user *Type: UserDefault: n/a | User that you invite to join a channel. |
channelIdType: stringDefault: Guid.NewGuid() | ID of the direct channel. If no value is provided a random Guid() will be generated and set as the Channel ID. |
channelDataType: objectDefault: null | Information about the channel. |
→ NameType: stringDefault: string.Empty | Display name for the channel. |
→ DescriptionType: stringDefault: string.Empty | Additional details about the channel. |
→ CustomDataType: Dictionary<string, object>Default: new () | Any custom properties or metadata associated with the channel. |
→ UpdatedType: stringDefault: string.Empty | Timestamp indicating when the channel was last updated or modified. |
→ StatusType: stringDefault: string.Empty | Current status of the channel, such as online, offline, or archived. |
→ TypeType: stringDefault: string.Empty | Type of the channel, like direct. |
API limits
To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.
Output
This method returns a Task<ChatOperationResult<CreatedChannelWrapper>> with the following data:
| Parameter | Description |
|---|---|
CreatedChannelType: Channel | Returned object containing the updated channel metadata. |
HostMembershipType: Membership | Returned object containing the updated host (channel owner) metadata. |
InviteesMembershipsType: List<Membership> | Single-item list containing the updated data of the invited user. |
Sample code
Invite agent-007 to a 1:1 conversation to talk about customer XYZ.
1
Create group channel
Group channels enable multi-user conversations for team collaboration and community building. Access requires an invitation.
CreateGroupConversation() performs these actions:
- Creates a channel with the
grouptype - Sets channel membership for the channel owner
- Invites other users to join and creates memberships with a
"pending"status
Receive messages
Call Connect() to start receiving messages on the channel.
Method signature
This method takes the following parameters:
1chat.CreateGroupConversation(
2 List<User> users,
3 string channelId = "",
4 ChatChannelData? channelData = null,
5 ChatMembershipData? membershipData = null)
6
7public class ChatChannelData
8{
9 public string Name { get; set; } = string.Empty;
10 public string Description { get; set; } = string.Empty;
11 public Dictionary<string, object> CustomData { get; set; } = new ();
12 public string Updated { get; internal set; } = string.Empty;
13 public string Status { get; set; } = string.Empty;
14 public string Type { get; set; } = string.Empty;
15}
Input
| Parameter | Description |
|---|---|
users *Type: List<User>Default: n/a | List of users that you invite to join a channel. You can invite a maximum number of 100 users at once as this is the limitation set by the App Context API that the InviteMultiple() method calls. |
channelIdType: stringDefault: Guid.NewGuid() | ID of the group channel. If no value is provided a random Guid() will be generated and set as the Channel ID. |
channelDataType: ChatChannelDataDefault: null | Information about the channel. |
→ NameType: stringDefault: string.Empty | Display name for the channel. |
→ DescriptionType: stringDefault: string.Empty | Additional details about the channel. |
→ CustomDataType: Dictionary<string, object>Default: new () | Any custom properties or metadata associated with the channel. |
→ UpdatedType: stringDefault: string.Empty | Timestamp indicating when the channel was last updated or modified. |
→ StatusType: stringDefault: string.Empty | Current status of the channel, such as online, offline, or archived. |
→ TypeType: stringDefault: string.Empty | Type of the channel, like group. |
API limits
To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.
Output
This method returns a Task<ChatOperationResult<CreatedChannelWrapper>> with the following data:
| Parameter | Description |
|---|---|
CreatedChannelType: Channel | Returned object containing the updated channel metadata. |
HostMembershipType: Membership | Returned object containing the updated host (channel owner) data. |
InviteesMembershipsType: List<Membership> | Returned object containing the updated metadata of the invited users. |
Sample code
Create a group conversation and invite agent-007 and agent-008 to have weekly syncs on customer XYZ.
1
Create public channel
Public channels are open to anyone without invitation. Use cases include Q&A forums, knowledge sharing, and live event chat.
Supported features
Public channels do not support typing indicators or read receipts. These features are impractical for large audiences.
CreatePublicConversation() creates a channel with the public type and the specified metadata.
Receive messages
Call Connect() to start receiving messages on the channel.
Method signature
This method takes the following parameters:
1chat.CreatePublicConversation(
2 string channelId = "",
3 ChatChannelData? additionalData = null
4)
5
6public class ChatChannelData
7{
8 public string Name { get; set; } = string.Empty;
9 public string Description { get; set; } = string.Empty;
10 public Dictionary<string, object> CustomData { get; set; } = new ();
11 public string Updated { get; internal set; } = string.Empty;
12 public string Status { get; set; } = string.Empty;
13 public string Type { get; set; } = string.Empty;
14}
Input
| Parameter | Description |
|---|---|
channelIdType: stringDefault: Guid.NewGuid() | ID of the group channel. If no value is provided a random Guid() will be generated and set as the Channel ID. |
channelDataType: ChatChannelDataDefault: null | Information about the channel. |
→ NameType: stringDefault: string.Empty | Display name for the channel. |
→ DescriptionType: stringDefault: string.Empty | Additional details about the channel. |
→ CustomDataType: Dictionary<string, object>Default: new () | Any custom properties or metadata associated with the channel. |
→ UpdatedType: stringDefault: string.Empty | Timestamp indicating when the channel was last updated or modified. |
→ StatusType: stringDefault: n/a | Current status of the channel, such as online, offline, or archived. |
→ TypeType: stringDefault: n/a | Type of the channel, like public. |
API limits
To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.
Output
| Type | Description |
|---|---|
Task<ChatOperationResult<Channel>> | Async task with the created Channel object. |
Sample code
Create a public ask-support channel.
1