On this page

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:

  1. Creates a channel with the direct type
  2. Sets channel membership for the channel owner
  3. Invites the other user and creates a membership with a "pending" status (generates an invite event)

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

* required
ParameterDescription
user *
Type: User
Default:
n/a
User that you invite to join a channel.
channelId
Type: string
Default:
Guid.NewGuid()
ID of the direct channel. If no value is provided a random Guid() will be generated and set as the Channel ID.
channelData
Type: object
Default:
null
Information about the channel.
 → Name
Type: string
Default:
string.Empty
Display name for the channel.
 → Description
Type: string
Default:
string.Empty
Additional details about the channel.
 → CustomData
Type: Dictionary<string, object>
Default:
new ()
Any custom properties or metadata associated with the channel.
 → Updated
Type: string
Default:
string.Empty
Timestamp indicating when the channel was last updated or modified.
 → Status
Type: string
Default:
string.Empty
Current status of the channel, such as online, offline, or archived.
 → Type
Type: string
Default:
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:

ParameterDescription
CreatedChannel
Type: Channel
Returned object containing the updated channel metadata.
HostMembershipReturned object containing the updated host (channel owner) metadata.
InviteesMemberships
Type: 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:

  1. Creates a channel with the group type
  2. Sets channel membership for the channel owner
  3. 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

* required
ParameterDescription
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.
channelId
Type: string
Default:
Guid.NewGuid()
ID of the group channel. If no value is provided a random Guid() will be generated and set as the Channel ID.
channelData
Type: ChatChannelData
Default:
null
Information about the channel.
 → Name
Type: string
Default:
string.Empty
Display name for the channel.
 → Description
Type: string
Default:
string.Empty
Additional details about the channel.
 → CustomData
Type: Dictionary<string, object>
Default:
new ()
Any custom properties or metadata associated with the channel.
 → Updated
Type: string
Default:
string.Empty
Timestamp indicating when the channel was last updated or modified.
 → Status
Type: string
Default:
string.Empty
Current status of the channel, such as online, offline, or archived.
 → Type
Type: string
Default:
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:

ParameterDescription
CreatedChannel
Type: Channel
Returned object containing the updated channel metadata.
HostMembership
Type: Membership
Returned object containing the updated host (channel owner) data.
InviteesMemberships
Type: 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

* required
ParameterDescription
channelId
Type: string
Default:
Guid.NewGuid()
ID of the group channel. If no value is provided a random Guid() will be generated and set as the Channel ID.
channelData
Type: ChatChannelData
Default:
null
Information about the channel.
 → Name
Type: string
Default:
string.Empty
Display name for the channel.
 → Description
Type: string
Default:
string.Empty
Additional details about the channel.
 → CustomData
Type: Dictionary<string, object>
Default:
new ()
Any custom properties or metadata associated with the channel.
 → Updated
Type: string
Default:
string.Empty
Timestamp indicating when the channel was last updated or modified.
 → Status
Type: string
Default:
n/a
Current status of the channel, such as online, offline, or archived.
 → Type
Type: string
Default:
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

TypeDescription
Task<ChatOperationResult<Channel>>
Async task with the created Channel object.

Sample code

Create a public ask-support channel.

1

Last updated on