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 a new channel, and in the event that 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.
Supported ✅ (please wait while we prepare a real example!)
Version 6
Beta (v0.0.1)
Similar to 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.
Version 6
Beta (v0.0.1)
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.
Conversation channel is unique based on its membership. When creating conversation, the system will check if a channel with the same membership already exists. If such channel already exists, the system will return the existing channel instead of creating a new one.
Version 6
Beta (v0.0.1)
#broadcast channel can only be created from Amity Social Cloud Console. We recommend to see instructions in #create-channel on how to create a Broadcast channel.