Create Channel
Last updated
Last updated
ChannelRepository
offers a function to create a new channel. This function provides support for creating three distinct types of channels, including Community
, Live
, and Conversation
. Each channel type has its own unique characteristics and capabilities as we explained earlier, and the create channel function allows users to easily create and customize channels to suit their specific needs.
The SDK offers two standard ways for creating channels. The first method involves specifying a specific channel ID during the channel creation process. The second method allows for the automatic generation of a unique channel ID. The create channel API is designed to ensure that the channel being created is new, and if the requested channel already exists, it will return a conflict error (400900). The channel ID parameter in the channel creation function may be left undefined, in which case the SDK will automatically generate a unique channel ID to avoid any conflicts with existing IDs.
This function on the SDK allows you to create a new #community-channel. The displayName
parameter is a required field, and it represents the public display name of the channel.
Here is a brief explanation of the function parameters:
displayName
: The public display name of the channel.
avatarFileId
: The image fileId that represents the image of the channel.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the channels.
isPublic
- Specify visibility for the community channel that public or private community.
Similar to the community channel creation function, the function allows you to create a new Live Channel. The displayName
parameter is a required field, and it represents the public display name of the channel.
Here is a brief explanation of the function parameters:
displayName
: The public display name of the channel.
avatarFileId
: The image fileId that represents the image of the channel.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the channels.
The Conversation channel creation function can also be utilized to create channels of the Conversation type. However, it should be noted that the channel ID for these channels will always be generated by the SDK. This ensures that the channel ID is unique and avoids any potential conflicts with existing channels
Here is a brief explanation of the function parameters:
userId
: The userId of the user that you'd like to chat with.
displayName
: The public display name of the channel.
avatarFileId
: The image fileId that represents the image of the channel.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the channels.
The conversation channel is unique based on its membership. When creating a conversation, the system will check if a channel with the same membership already exists. If such a channel already exists, the system will return the existing channel instead of creating a new one.
Broadcast channel can only be created from the Social Plus Console. We recommend to see instructions in on how to create a Broadcast channel.