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? hostMembershipData = null,
6 ChatMembershipData? inviteeMembershipData = null)
7
8public class ChatChannelData
9{
10 public string Name { get; set; } = string.Empty;
11 public string Description { get; set; } = string.Empty;
12 public Dictionary<string, object> CustomData { get; set; } = new ();
13 public string Updated { get; internal set; } = string.Empty;
14 public string Status { get; set; } = string.Empty;
15 public string Type { get; set; } = string.Empty;
show all 16 linesInput
userrequired#- User that you invite to join a channel.
channelId#- ID of the direct channel. If no value is provided a random
Guid()will be generated and set as the Channel ID. channelData#- Information about the channel.
- property of channelData:
Name# - Display name for the channel.
- property of channelData:
Description# - Additional details about the channel.
- property of channelData:
CustomData# - Any custom properties or metadata associated with the channel.
- property of channelData:
Updated# - Timestamp indicating when the channel was last updated or modified.
- property of channelData:
Status# - Current status of the channel, such as
online,offline, orarchived. - property of channelData:
Type# - Type of the channel, like
direct. hostMembershipData#- Custom membership data for the channel creator (host).
inviteeMembershipData#- Custom membership data for the invited user.
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:
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? hostMembershipData = null,
6 List<ChatMembershipData>? inviteesMembershipData = null)
7
8public class ChatChannelData
9{
10 public string Name { get; set; } = string.Empty;
11 public string Description { get; set; } = string.Empty;
12 public Dictionary<string, object> CustomData { get; set; } = new ();
13 public string Updated { get; internal set; } = string.Empty;
14 public string Status { get; set; } = string.Empty;
15 public string Type { get; set; } = string.Empty;
show all 16 linesInput
usersrequired#- 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. channelId#- ID of the group channel. If no value is provided a random
Guid()will be generated and set as the Channel ID. channelData#- Information about the channel.
- property of channelData:
Name# - Display name for the channel.
- property of channelData:
Description# - Additional details about the channel.
- property of channelData:
CustomData# - Any custom properties or metadata associated with the channel.
- property of channelData:
Updated# - Timestamp indicating when the channel was last updated or modified.
- property of channelData:
Status# - Current status of the channel, such as
online,offline, orarchived. - property of channelData:
Type# - Type of the channel, like
group. hostMembershipData#- Custom membership data for the channel creator (host).
inviteesMembershipData#- List of custom membership data objects for the invited users, corresponding to each user in the
userslist.
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:
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
channelId#- ID of the group channel. If no value is provided a random
Guid()will be generated and set as the Channel ID. additionalData#- Information about the channel.
- property of additionalData:
Name# - Display name for the channel.
- property of additionalData:
Description# - Additional details about the channel.
- property of additionalData:
CustomData# - Any custom properties or metadata associated with the channel.
- property of additionalData:
Updated# - Timestamp indicating when the channel was last updated or modified.
- property of additionalData:
Status# - Current status of the channel, such as
online,offline, orarchived. - property of additionalData:
Type# - 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